Class: XDry::CompoundSelectorDef

Inherits:
SelectorDef show all
Defined in:
lib/xdry/parsing/parts/selectors.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from SelectorDef

parse

Constructor Details

#initialize(components) ⇒ CompoundSelectorDef

Returns a new instance of CompoundSelectorDef.



92
93
94
# File 'lib/xdry/parsing/parts/selectors.rb', line 92

def initialize components
  @components = components.freeze
end

Instance Attribute Details

#componentsObject (readonly)

Returns the value of attribute components.



90
91
92
# File 'lib/xdry/parsing/parts/selectors.rb', line 90

def components
  @components
end

Instance Method Details

#selectorObject



96
97
98
# File 'lib/xdry/parsing/parts/selectors.rb', line 96

def selector
  @selector ||= @components.collect { |comp| comp.keyword }.join("")
end

#simple?Boolean

Returns:

  • (Boolean)


100
# File 'lib/xdry/parsing/parts/selectors.rb', line 100

def simple?; false; end

#to_sObject



102
103
104
# File 'lib/xdry/parsing/parts/selectors.rb', line 102

def to_s
  @components.collect { |comp| comp.to_s }.join(" ")
end

#var_name_after_keyword(keyword) ⇒ Object



106
107
108
109
# File 'lib/xdry/parsing/parts/selectors.rb', line 106

def var_name_after_keyword keyword
  comp = @components.find { |comp| comp.keyword == keyword }
  comp && comp.arg_name
end