Class: AgnosticBackend::Queryable::Value
- Defined in:
- lib/agnostic_backend/queryable/value.rb
Instance Attribute Summary collapse
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
-
#value ⇒ Object
Returns the value of attribute value.
Attributes inherited from TreeNode
Instance Method Summary collapse
- #==(o) ⇒ Object
- #associated_attribute ⇒ Object
-
#initialize(value, parent:, context:) ⇒ Value
constructor
A new instance of Value.
- #type ⇒ Object
Methods inherited from TreeNode
Methods included from Utilities
Constructor Details
#initialize(value, parent:, context:) ⇒ Value
Returns a new instance of Value.
8 9 10 11 |
# File 'lib/agnostic_backend/queryable/value.rb', line 8 def initialize(value, parent:, context:) super([], context) @value, @parent = value, parent end |
Instance Attribute Details
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
6 7 8 |
# File 'lib/agnostic_backend/queryable/value.rb', line 6 def parent @parent end |
#value ⇒ Object
Returns the value of attribute value.
5 6 7 |
# File 'lib/agnostic_backend/queryable/value.rb', line 5 def value @value end |
Instance Method Details
#==(o) ⇒ Object
13 14 15 |
# File 'lib/agnostic_backend/queryable/value.rb', line 13 def ==(o) super && o.value == value end |
#associated_attribute ⇒ Object
17 18 19 |
# File 'lib/agnostic_backend/queryable/value.rb', line 17 def associated_attribute parent.attribute if parent.respond_to? :attribute end |
#type ⇒ Object
21 22 23 24 |
# File 'lib/agnostic_backend/queryable/value.rb', line 21 def type return :text if associated_attribute.try(:any?) associated_attribute.type if associated_attribute.present? end |