Class: Infoboxer::Navigation::Lookup::Selector
- Inherits:
-
Object
- Object
- Infoboxer::Navigation::Lookup::Selector
- Defined in:
- lib/infoboxer/navigation/selector.rb
Overview
Incapsulates storage of selectors, used in node lookup.
See Lookup::Node for detailed explanation of available selectors.
Instance Attribute Summary collapse
-
#arg ⇒ Object
readonly
Returns the value of attribute arg.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #===(other) ⇒ Object
-
#initialize(*arg, &block) ⇒ Selector
constructor
A new instance of Selector.
- #inspect ⇒ Object
Constructor Details
#initialize(*arg, &block) ⇒ Selector
Returns a new instance of Selector.
10 11 12 13 14 15 |
# File 'lib/infoboxer/navigation/selector.rb', line 10 def initialize(*arg, &block) @arg = [arg, block].flatten.compact.map(&method(:sym_to_class)) @arg.each do |a| a.compact! if a.is_a?(Hash) end end |
Instance Attribute Details
#arg ⇒ Object (readonly)
Returns the value of attribute arg.
17 18 19 |
# File 'lib/infoboxer/navigation/selector.rb', line 17 def arg @arg end |
Instance Method Details
#==(other) ⇒ Object
19 20 21 |
# File 'lib/infoboxer/navigation/selector.rb', line 19 def ==(other) self.class == other.class && arg == other.arg end |
#===(other) ⇒ Object
27 28 29 |
# File 'lib/infoboxer/navigation/selector.rb', line 27 def ===(other) @arg.all? { |a| arg_matches?(a, other) } end |
#inspect ⇒ Object
23 24 25 |
# File 'lib/infoboxer/navigation/selector.rb', line 23 def inspect "#<Selector(#{@arg.map(&:to_s).join(', ')})>" end |