Class: KQL::Mapping
Instance Attribute Summary collapse
-
#mapping ⇒ Object
Returns the value of attribute mapping.
Attributes inherited from Query
Instance Method Summary collapse
- #==(other) ⇒ Object
- #execute(document) ⇒ Object
-
#initialize(alternatives, mapping) ⇒ Mapping
constructor
A new instance of Mapping.
Constructor Details
#initialize(alternatives, mapping) ⇒ Mapping
Returns a new instance of Mapping.
7 8 9 10 |
# File 'lib/kql/mapping.rb', line 7 def initialize(alternatives, mapping) super(alternatives) @mapping = mapping end |
Instance Attribute Details
#mapping ⇒ Object
Returns the value of attribute mapping.
5 6 7 |
# File 'lib/kql/mapping.rb', line 5 def mapping @mapping end |
Instance Method Details
#==(other) ⇒ Object
17 18 19 20 21 |
# File 'lib/kql/mapping.rb', line 17 def ==(other) return false unless other.is_a?(Mapping) super(other) && other.mapping = mapping end |
#execute(document) ⇒ Object
12 13 14 15 |
# File 'lib/kql/mapping.rb', line 12 def execute(document) nodes = super nodes.map { |node| mapping.execute(node) } end |