Class: Piglet::Field::DirectExpression
- Inherits:
-
Object
- Object
- Piglet::Field::DirectExpression
- Includes:
- Field
- Defined in:
- lib/piglet/field/direct_expression.rb
Constant Summary
Constants included from Field
Field::FUNCTIONS, Field::SYMBOLIC_OPERATORS
Instance Attribute Summary collapse
-
#string ⇒ Object
readonly
Returns the value of attribute string.
Attributes included from Field
Instance Method Summary collapse
-
#initialize(string, predecessor) ⇒ DirectExpression
constructor
A new instance of DirectExpression.
- #method_missing(name, *args) ⇒ Object
- #to_s(inner = false) ⇒ Object
Methods included from Field
#and, #as, #cast, #diff, #distinct, #empty?, #field, #field_alias, #filter, #flatten, #generate_field_alias, #get, #limit, #matches, #ne, #neg, #not, #not_null?, #null?, #or, #order, #sample
Constructor Details
#initialize(string, predecessor) ⇒ DirectExpression
Returns a new instance of DirectExpression.
10 11 12 13 |
# File 'lib/piglet/field/direct_expression.rb', line 10 def initialize(string, predecessor) @string = string @predecessors = [predecessor] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/piglet/field/direct_expression.rb', line 19 def method_missing(name, *args) if name.to_s =~ /^\w+$/ && args.empty? field(name) else super end end |
Instance Attribute Details
#string ⇒ Object (readonly)
Returns the value of attribute string.
8 9 10 |
# File 'lib/piglet/field/direct_expression.rb', line 8 def string @string end |
Instance Method Details
#to_s(inner = false) ⇒ Object
15 16 17 |
# File 'lib/piglet/field/direct_expression.rb', line 15 def to_s(inner=false) @string end |