Class: Arel::Nodes::Function
- Inherits:
-
Object
- Object
- Arel::Nodes::Function
- Includes:
- Expressions, Math, ArelExtensions::Aliases, ArelExtensions::BooleanFunctions, ArelExtensions::Comparators, ArelExtensions::DateDuration, ArelExtensions::Math, ArelExtensions::MathFunctions, ArelExtensions::NullFunctions, ArelExtensions::Predications, ArelExtensions::StringFunctions
- Defined in:
- lib/arel_extensions.rb,
lib/arel_extensions.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#alias ⇒ Object
Returns the value of attribute alias.
Instance Method Summary collapse
- #as(other) ⇒ Object
-
#initialize(expr, aliaz = nil) ⇒ Function
constructor
A new instance of Function.
- #old_initialize ⇒ Object
Methods included from ArelExtensions::Predications
#cast, #convert_to_node, #imatches, #in, #matches, #not_in, #when
Methods included from ArelExtensions::NullFunctions
#coalesce, #coalesce_blank, #if_present, #is_not_null, #is_null
Methods included from ArelExtensions::BooleanFunctions
Methods included from ArelExtensions::StringFunctions
#&, #[], #ai_collate, #ai_imatches, #ai_matches, #blank, #byte_length, #byte_size, #char_length, #ci_collate, #collate, #concat, #downcase, #edit_distance, #group_concat, #idoes_not_match, #idoes_not_match_all, #idoes_not_match_any, #imatches, #imatches_all, #imatches_any, #length, #levenshtein_distance, #locate, #ltrim, #md5, #not_blank, #regexp_replace, #repeat, #replace, #rtrim, #smatches, #soundex, #substring, #trim, #upcase
Methods included from ArelExtensions::Warning
Methods included from ArelExtensions::MathFunctions
#*, #/, #abs, #ceil, #floor, #format_number, #log10, #pow, #power, #round, #std, #sum, #variance
Methods included from ArelExtensions::DateDuration
#day, #format, #format_date, #hour, #minute, #month, #second, #wday, #week, #year
Methods included from ArelExtensions::Comparators
Methods included from ArelExtensions::Math
Methods included from ArelExtensions::Aliases
Constructor Details
#initialize(expr, aliaz = nil) ⇒ Function
Returns a new instance of Function.
207 208 209 210 |
# File 'lib/arel_extensions.rb', line 207 def initialize(expr, aliaz = nil) old_initialize(expr) self.alias = aliaz end |
Instance Attribute Details
#alias ⇒ Object
Returns the value of attribute alias.
204 205 206 |
# File 'lib/arel_extensions.rb', line 204 def alias @alias end |
Instance Method Details
#as(other) ⇒ Object
214 215 216 217 218 |
# File 'lib/arel_extensions.rb', line 214 def as other res = Arel::Nodes::As.new(self.clone, Arel.sql(other)) self.alias = Arel.sql(other) res end |
#old_initialize ⇒ Object
205 |
# File 'lib/arel_extensions.rb', line 205 alias_method :old_initialize, :initialize |