Class: Lunar::KeywordMatches
- Inherits:
-
Object
- Object
- Lunar::KeywordMatches
- Defined in:
- lib/lunar/keyword_matches.rb
Overview
given ‘nest`, `att` and it’s ‘val`.
Instance Attribute Summary collapse
-
#att ⇒ Object
readonly
Returns the value of attribute att.
-
#nest ⇒ Object
readonly
Returns the value of attribute nest.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #distkey ⇒ Object
-
#initialize(nest, att, value) ⇒ KeywordMatches
constructor
A new instance of KeywordMatches.
Constructor Details
#initialize(nest, att, value) ⇒ KeywordMatches
Returns a new instance of KeywordMatches.
9 10 11 |
# File 'lib/lunar/keyword_matches.rb', line 9 def initialize(nest, att, value) @nest, @att, @value = nest, att.to_sym, value end |
Instance Attribute Details
#att ⇒ Object (readonly)
Returns the value of attribute att.
6 7 8 |
# File 'lib/lunar/keyword_matches.rb', line 6 def att @att end |
#nest ⇒ Object (readonly)
Returns the value of attribute nest.
5 6 7 |
# File 'lib/lunar/keyword_matches.rb', line 5 def nest @nest end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
7 8 9 |
# File 'lib/lunar/keyword_matches.rb', line 7 def value @value end |
Instance Method Details
#distkey ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/lunar/keyword_matches.rb', line 13 def distkey return if keys.flatten.empty? nest[{ att => value }.hash].tap do |dk| dk.zunionstore keys.flatten end end |