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
- #==(other) ⇒ Object (also: #eql?)
- #accept(target) ⇒ Object
- #children ⇒ Object
- #each(&block) ⇒ Object
- #hash ⇒ Object
- #to_css ⇒ Object (also: #to_s)
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 |
#children ⇒ Object
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 |
#hash ⇒ Object
26 27 28 |
# File 'lib/csspool/visitable.rb', line 26 def hash @hash ||= children.map { |child| child.hash }.hash end |