Class: CssParserMaster::Selectors

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/css_parser_master/selectors.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(selectors = []) ⇒ Selectors

Returns a new instance of Selectors.



23
24
25
# File 'lib/css_parser_master/selectors.rb', line 23

def initialize(selectors = []) 
  @selectors = selectors
end

Instance Attribute Details

#selectorsObject (readonly)

Returns the value of attribute selectors.



5
6
7
# File 'lib/css_parser_master/selectors.rb', line 5

def selectors
  @selectors
end

Instance Method Details

#<<(selector) ⇒ Object



7
8
9
# File 'lib/css_parser_master/selectors.rb', line 7

def << selector
  selectors << selector      
end

#allObject



11
12
13
# File 'lib/css_parser_master/selectors.rb', line 11

def all
  map{|sel| sel.split(',') } 
end

#eachObject



15
16
17
# File 'lib/css_parser_master/selectors.rb', line 15

def each
  selectors.each { |sel| yield sel }
end

#empty?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/css_parser_master/selectors.rb', line 19

def empty?
  selectors.empty?
end