Class: Eso::Filter
- Inherits:
-
Object
- Object
- Eso::Filter
- Defined in:
- lib/eso/filter.rb
Defined Under Namespace
Classes: FilterItem
Instance Attribute Summary collapse
-
#filter_items ⇒ Object
These are the individual filter items.
-
#type ⇒ Object
These are defined in Eso::Filters which reside in the respective service they are related to.
Instance Method Summary collapse
-
#<<(filter_item) ⇒ Object
Append a filter_item later.
-
#initialize(type:, items: []) ⇒ Eso::Filter
constructor
Constructor for Filter.
- #to_hash ⇒ Object (also: #to_h)
- #to_json ⇒ Object
Constructor Details
#initialize(type:, items: []) ⇒ Eso::Filter
Constructor for Filter.
15 16 17 18 |
# File 'lib/eso/filter.rb', line 15 def initialize(type:, items: []) @type = type @filter_items = items end |
Instance Attribute Details
#filter_items ⇒ Object
These are the individual filter items
7 8 9 |
# File 'lib/eso/filter.rb', line 7 def filter_items @filter_items end |
#type ⇒ Object
These are defined in Eso::Filters which reside in the respective service they are related to.
4 5 6 |
# File 'lib/eso/filter.rb', line 4 def type @type end |
Instance Method Details
#<<(filter_item) ⇒ Object
Append a filter_item later
21 22 23 |
# File 'lib/eso/filter.rb', line 21 def <<(filter_item) @filter_items << filter_item end |
#to_hash ⇒ Object Also known as: to_h
29 30 31 32 33 34 35 36 |
# File 'lib/eso/filter.rb', line 29 def to_hash hash = {} hash[@type.to_sym] = { valueClass: 'Array', items: @filter_items.map{|item| item.to_hash} } hash end |
#to_json ⇒ Object
25 26 27 |
# File 'lib/eso/filter.rb', line 25 def to_json self.to_hash.to_json end |