Class: SearchKit::Models::Keys
- Inherits:
-
Object
- Object
- SearchKit::Models::Keys
- Includes:
- Enumerable
- Defined in:
- lib/search_kit/models/keys.rb
Instance Attribute Summary collapse
-
#contents ⇒ Object
readonly
Returns the value of attribute contents.
-
#member_class ⇒ Object
readonly
Returns the value of attribute member_class.
Class Method Summary collapse
Instance Method Summary collapse
- #<<(new_key) ⇒ Object
- #creator ⇒ Object
- #each(&block) ⇒ Object
-
#initialize(contents = []) ⇒ Keys
constructor
A new instance of Keys.
- #tokens ⇒ Object
Constructor Details
Instance Attribute Details
#contents ⇒ Object (readonly)
Returns the value of attribute contents.
10 11 12 |
# File 'lib/search_kit/models/keys.rb', line 10 def contents @contents end |
#member_class ⇒ Object (readonly)
Returns the value of attribute member_class.
10 11 12 |
# File 'lib/search_kit/models/keys.rb', line 10 def member_class @member_class end |
Class Method Details
.[](*arguments) ⇒ Object
6 7 8 |
# File 'lib/search_kit/models/keys.rb', line 6 def self.[](*arguments) new(arguments) end |
Instance Method Details
#<<(new_key) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/search_kit/models/keys.rb', line 17 def <<(new_key) case new_key when Hash then contents << member_class.new(new_key) when member_class then contents << new_key else contents end end |
#creator ⇒ Object
29 30 31 |
# File 'lib/search_kit/models/keys.rb', line 29 def creator self.class.new(select(&:creator?)) end |
#each(&block) ⇒ Object
25 26 27 |
# File 'lib/search_kit/models/keys.rb', line 25 def each(&block) contents.each(&block) end |
#tokens ⇒ Object
33 34 35 |
# File 'lib/search_kit/models/keys.rb', line 33 def tokens contents.map(&:token) end |