Class: AgnosticBackend::Queryable::Attribute
- Includes:
- Utilities
- Defined in:
- lib/agnostic_backend/queryable/attribute.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
Attributes inherited from TreeNode
Instance Method Summary collapse
- #==(o) ⇒ Object
- #any? ⇒ Boolean
-
#initialize(name, parent:, context:) ⇒ Attribute
constructor
A new instance of Attribute.
- #score? ⇒ Boolean
- #type ⇒ Object
Methods included from Utilities
Methods inherited from TreeNode
Constructor Details
#initialize(name, parent:, context:) ⇒ Attribute
Returns a new instance of Attribute.
8 9 10 11 |
# File 'lib/agnostic_backend/queryable/attribute.rb', line 8 def initialize(name, parent:, context:) super([], context) @name, @parent = name, parent end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/agnostic_backend/queryable/attribute.rb', line 6 def name @name end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
6 7 8 |
# File 'lib/agnostic_backend/queryable/attribute.rb', line 6 def parent @parent end |
Instance Method Details
#==(o) ⇒ Object
13 14 15 |
# File 'lib/agnostic_backend/queryable/attribute.rb', line 13 def ==(o) super && o.name == name end |
#any? ⇒ Boolean
21 22 23 |
# File 'lib/agnostic_backend/queryable/attribute.rb', line 21 def any? @name == '*' end |
#score? ⇒ Boolean
25 26 27 |
# File 'lib/agnostic_backend/queryable/attribute.rb', line 25 def score? @name == '_score' end |
#type ⇒ Object
17 18 19 |
# File 'lib/agnostic_backend/queryable/attribute.rb', line 17 def type value_for_key(context.index.schema, name).try(:type) end |