Class: Caoutsearch::Search::DSL::Item
- Inherits:
-
Object
- Object
- Caoutsearch::Search::DSL::Item
- Defined in:
- lib/caoutsearch/search/dsl/item.rb
Constant Summary collapse
- PROPERTIES_TO_INSPECT =
i[name block].freeze
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #has_block? ⇒ Boolean
- #indexes ⇒ Object
-
#initialize(name, options = {}, &block) ⇒ Item
constructor
A new instance of Item.
- #inspect ⇒ Object
Constructor Details
#initialize(name, options = {}, &block) ⇒ Item
Returns a new instance of Item.
11 12 13 14 15 |
# File 'lib/caoutsearch/search/dsl/item.rb', line 11 def initialize(name, = {}, &block) @name = name = @block = block if block end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
7 8 9 |
# File 'lib/caoutsearch/search/dsl/item.rb', line 7 def block @block end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/caoutsearch/search/dsl/item.rb', line 7 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'lib/caoutsearch/search/dsl/item.rb', line 7 def end |
Instance Method Details
#has_block? ⇒ Boolean
17 18 19 |
# File 'lib/caoutsearch/search/dsl/item.rb', line 17 def has_block? block.present? end |
#indexes ⇒ Object
21 22 23 |
# File 'lib/caoutsearch/search/dsl/item.rb', line 21 def indexes @indexes ||= Array.wrap([:indexes].presence || name) end |
#inspect ⇒ Object
25 26 27 28 29 |
# File 'lib/caoutsearch/search/dsl/item.rb', line 25 def inspect properties = properties_to_inspect.map { |k, v| " #{k}: #{v}" } "#<#{self.class}#{properties.join(",")}>" end |