-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure custom template objects always raise UnknownVariable exception…
…s when attributes cannot be resolved
- Loading branch information
Showing
18 changed files
with
119 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,5 @@ | ||
class Marten::DB::Field::File::File | ||
include Marten::Template::Object | ||
|
||
# :nodoc: | ||
def resolve_template_attribute(key : ::String) | ||
case key | ||
when "attached?" | ||
attached? | ||
when "name" | ||
name | ||
when "size" | ||
size | ||
when "url" | ||
url | ||
end | ||
end | ||
template_attributes :attached?, :name, :size, :url | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,6 @@ | ||
class Marten::DB::Query::Page(M) | ||
include Marten::Template::Object | ||
|
||
def resolve_template_attribute(key : String) | ||
case key | ||
when "all?" | ||
all? | ||
when "any?" | ||
any? | ||
when "count" | ||
count | ||
when "empty?" | ||
empty? | ||
when "first?" | ||
first? | ||
when "next_page?" | ||
next_page? | ||
when "next_page_number" | ||
next_page_number | ||
when "none?" | ||
none? | ||
when "number" | ||
number | ||
when "one?" | ||
one? | ||
when "previous_page?" | ||
previous_page? | ||
when "previous_page_number" | ||
previous_page_number | ||
when "size" | ||
size | ||
end | ||
end | ||
template_attributes :all?, :any?, :count, :empty?, :first?, :next_page?, :next_page_number, :none?, :number, :one?, | ||
:previous_page?, :previous_page_number, :size | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,5 @@ | ||
class Marten::DB::Query::Paginator(M) | ||
include Marten::Template::Object | ||
|
||
def resolve_template_attribute(key : String) | ||
case key | ||
when "page_size" | ||
page_size | ||
when "pages_count" | ||
pages_count | ||
end | ||
end | ||
template_attributes :page_size, :pages_count | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,6 @@ | ||
class Marten::DB::Query::Set(M) | ||
include Marten::Template::Object | ||
|
||
def resolve_template_attribute(key : String) | ||
case key | ||
when "all" | ||
all | ||
when "all?" | ||
all? | ||
when "any?" | ||
any? | ||
when "count" | ||
count | ||
when "distinct" | ||
distinct | ||
when "empty?" | ||
empty? | ||
when "exists?" | ||
exists? | ||
when "first" | ||
first | ||
when "first!" | ||
first! | ||
when "first?" | ||
first? | ||
when "last" | ||
last | ||
when "last!" | ||
last! | ||
when "none" | ||
none | ||
when "none?" | ||
none? | ||
when "one?" | ||
one? | ||
when "reverse" | ||
reverse | ||
when "size" | ||
size | ||
end | ||
end | ||
template_attributes :all, :all?, :any?, :count, :distinct, :empty?, :exists?, :first, :first!, :first?, :last, :last!, | ||
:none, :none?, :one?, :reverse, :size | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters