Module: CSSPool::Visitable

Included in:
CSS::Charset, CSS::Declaration, CSS::ImportRule, CSS::Media, CSS::RuleSet, Node
Defined in:
lib/csspool/visitable.rb

Instance Method Summary collapse

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



12
13
14
15
# File 'lib/csspool/visitable.rb', line 12

def == other
  return false unless self.class == other.class
  accept Visitors::Comparable.new(other)
end

#accept(target) ⇒ Object



3
4
5
# File 'lib/csspool/visitable.rb', line 3

def accept target
  target.accept self
end

#childrenObject



22
23
24
# File 'lib/csspool/visitable.rb', line 22

def children
  accept Visitors::Children.new
end

#each(&block) ⇒ Object



18
19
20
# File 'lib/csspool/visitable.rb', line 18

def each &block
  accept Visitors::Iterator.new(block)
end

#hashObject



26
27
28
# File 'lib/csspool/visitable.rb', line 26

def hash
  @hash ||= children.map { |child| child.hash }.hash
end

#to_cssObject Also known as: to_s



7
8
9
# File 'lib/csspool/visitable.rb', line 7

def to_css
  accept Visitors::ToCSS.new
end