Class: XDry::CompoundSelectorDef
- Inherits:
-
SelectorDef
- Object
- SelectorDef
- XDry::CompoundSelectorDef
- Defined in:
- lib/xdry/parsing/parts/selectors.rb
Instance Attribute Summary collapse
-
#components ⇒ Object
readonly
Returns the value of attribute components.
Instance Method Summary collapse
-
#initialize(components) ⇒ CompoundSelectorDef
constructor
A new instance of CompoundSelectorDef.
- #selector ⇒ Object
- #simple? ⇒ Boolean
- #to_s ⇒ Object
- #var_name_after_keyword(keyword) ⇒ Object
Methods inherited from SelectorDef
Constructor Details
#initialize(components) ⇒ CompoundSelectorDef
Returns a new instance of CompoundSelectorDef.
74 75 76 |
# File 'lib/xdry/parsing/parts/selectors.rb', line 74 def initialize components @components = components.freeze end |
Instance Attribute Details
#components ⇒ Object (readonly)
Returns the value of attribute components.
72 73 74 |
# File 'lib/xdry/parsing/parts/selectors.rb', line 72 def components @components end |
Instance Method Details
#selector ⇒ Object
78 79 80 |
# File 'lib/xdry/parsing/parts/selectors.rb', line 78 def selector @selector ||= @components.collect { |comp| comp.keyword }.join("") end |
#simple? ⇒ Boolean
82 |
# File 'lib/xdry/parsing/parts/selectors.rb', line 82 def simple?; false; end |
#to_s ⇒ Object
84 85 86 |
# File 'lib/xdry/parsing/parts/selectors.rb', line 84 def to_s @components.collect { |comp| comp.to_s }.join(" ") end |
#var_name_after_keyword(keyword) ⇒ Object
88 89 90 91 |
# File 'lib/xdry/parsing/parts/selectors.rb', line 88 def var_name_after_keyword keyword comp = @components.find { |comp| comp.keyword == keyword } comp && comp.arg_name end |