Class: CloudSesame::Query::AST::Literal
- Inherits:
-
SingleBranch
- Object
- SingleBranch
- CloudSesame::Query::AST::Literal
- Defined in:
- lib/cloud_sesame/query/ast/literal.rb
Instance Attribute Summary collapse
-
#field ⇒ Object
Returns the value of attribute field.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Attributes inherited from SingleBranch
Instance Method Summary collapse
- #as_field ⇒ Object
- #compile ⇒ Object
- #detailed ⇒ Object
-
#initialize(field = nil, value = nil, options = {}) ⇒ Literal
constructor
A new instance of Literal.
Methods inherited from SingleBranch
Constructor Details
#initialize(field = nil, value = nil, options = {}) ⇒ Literal
Returns a new instance of Literal.
9 10 11 12 13 |
# File 'lib/cloud_sesame/query/ast/literal.rb', line 9 def initialize(field = nil, value = nil, = {}) @field = field @value = to_value value ((@options = || {})[:included] ||= []) << @value end |
Instance Attribute Details
#field ⇒ Object
Returns the value of attribute field.
6 7 8 |
# File 'lib/cloud_sesame/query/ast/literal.rb', line 6 def field @field end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'lib/cloud_sesame/query/ast/literal.rb', line 7 def @options end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
7 8 9 |
# File 'lib/cloud_sesame/query/ast/literal.rb', line 7 def value @value end |
Instance Method Details
#as_field ⇒ Object
15 16 17 |
# File 'lib/cloud_sesame/query/ast/literal.rb', line 15 def as_field [:as] || field end |
#compile ⇒ Object
19 20 21 |
# File 'lib/cloud_sesame/query/ast/literal.rb', line 19 def compile [:detailed] ? detailed_format : standard_format end |
#detailed ⇒ Object
23 24 25 26 |
# File 'lib/cloud_sesame/query/ast/literal.rb', line 23 def detailed [:detailed] = true return self end |