Class: CSSPool::Node

### Home Classes Methods

### In Files

- lib/csspool/node.rb

### Parent

Object

### Methods

- #==
- #accept
- #children
- #each
- #eql?
- #hash
- #to_css
- #to_minified_css
- #to_s

### Included Modules

- Enumerable

### Files

- CHANGELOG.rdoc
- Manifest.txt

### Class/Module Index

Quicksearch

- CSSPool
- CSSPool::CSS
- CSSPool::CSS::Charset
- CSSPool::CSS::Declaration
- CSSPool::CSS::Document
- CSSPool::CSS::DocumentHandler
- CSSPool::CSS::DocumentQuery
- CSSPool::CSS::FontfaceRule
- CSSPool::CSS::ImportRule
- CSSPool::CSS::KeyframesBlock
- CSSPool::CSS::KeyframesRule
- CSSPool::CSS::MediaFeature
- CSSPool::CSS::MediaQuery
- CSSPool::CSS::MediaQueryList
- CSSPool::CSS::MediaType
- CSSPool::CSS::NamespaceRule
- CSSPool::CSS::Parser
- CSSPool::CSS::RuleSet
- CSSPool::CSS::SupportsRule
- CSSPool::CSS::Tokenizer
- CSSPool::CSS::Tokenizer::ScanError
- CSSPool::Collection
- CSSPool::Node
- CSSPool::SAC
- CSSPool::SAC::Document
- CSSPool::SAC::Parser
- CSSPool::Selector
- CSSPool::Selectors
- CSSPool::Selectors::Additional
- CSSPool::Selectors::Attribute
- CSSPool::Selectors::Class
- CSSPool::Selectors::Id
- CSSPool::Selectors::PseudoClass
- CSSPool::Selectors::PseudoElement
- CSSPool::Selectors::Simple
- CSSPool::Selectors::Type
- CSSPool::Selectors::Universal
- CSSPool::Terms
- CSSPool::Terms::Function
- CSSPool::Terms::Hash
- CSSPool::Terms::Ident
- CSSPool::Terms::Math
- CSSPool::Terms::Number
- CSSPool::Terms::Ratio
- CSSPool::Terms::Resolution
- CSSPool::Terms::Rgb
- CSSPool::Terms::String
- CSSPool::Terms::URI
- CSSPool::Visitors
- CSSPool::Visitors::Children
- CSSPool::Visitors::Comparable
- CSSPool::Visitors::Iterator
- CSSPool::Visitors::ToCSS
- CSSPool::Visitors::ToMinifiedCSS
- CSSPool::Visitors::Visitor

No matching classes.

# CSSPool::Node

### Attributes

inner_end_pos[RW]

These give the position of this node in the source CSS. Not all node types are supported. "Outer" represents the start/end of this node, "inner" represents the start/end of this node's children. Outer will not contain leading or trailing comments or whitespace, while inner will. For example, in this code:

1 /* test1 */ 2 @document domain('example.com') { 3 /* test2 */ 4 * { color: blue; } 5 /* test3 */ 6 } /* test4 */

The index will represent the position: outer_start_pos: 2:0 inner_start_pos: 2:33 inner_end_pos: 6:0 outer_end_pos: 6:1

inner_start_pos[RW]

These give the position of this node in the source CSS. Not all node types are supported. "Outer" represents the start/end of this node, "inner" represents the start/end of this node's children. Outer will not contain leading or trailing comments or whitespace, while inner will. For example, in this code:

1 /* test1 */ 2 @document domain('example.com') { 3 /* test2 */ 4 * { color: blue; } 5 /* test3 */ 6 } /* test4 */

The index will represent the position: outer_start_pos: 2:0 inner_start_pos: 2:33 inner_end_pos: 6:0 outer_end_pos: 6:1

outer_end_pos[RW]

These give the position of this node in the source CSS. Not all node types are supported. "Outer" represents the start/end of this node, "inner" represents the start/end of this node's children. Outer will not contain leading or trailing comments or whitespace, while inner will. For example, in this code:

1 /* test1 */ 2 @document domain('example.com') { 3 /* test2 */ 4 * { color: blue; } 5 /* test3 */ 6 } /* test4 */

The index will represent the position: outer_start_pos: 2:0 inner_start_pos: 2:33 inner_end_pos: 6:0 outer_end_pos: 6:1

outer_start_pos[RW]

These give the position of this node in the source CSS. Not all node types are supported. "Outer" represents the start/end of this node, "inner" represents the start/end of this node's children. Outer will not contain leading or trailing comments or whitespace, while inner will. For example, in this code:

1 /* test1 */ 2 @document domain('example.com') { 3 /* test2 */ 4 * { color: blue; } 5 /* test3 */ 6 } /* test4 */

The index will represent the position: outer_start_pos: 2:0 inner_start_pos: 2:33 inner_end_pos: 6:0 outer_end_pos: 6:1

### Public Instance Methods

==(other) click to toggle source

    # File lib/csspool/node.rb, line 44
    def == other
      return false unless self.class == other.class

      accept Visitors::Comparable.new other
    end

Also aliased as: eql?
accept(target) click to toggle source

    # File lib/csspool/node.rb, line 27
    def accept target
      target.accept self
    end

children() click to toggle source

    # File lib/csspool/node.rb, line 55
    def children
      accept Visitors::Children.new
    end

each(&block) click to toggle source

    # File lib/csspool/node.rb, line 51
    def each &block
      Visitors::Iterator.new(block).accept self
    end

eql?(other) click to toggle source
Alias for: ==
hash() click to toggle source

    # File lib/csspool/node.rb, line 59
    def hash
      @hash ||= children.map { |child| child.hash }.hash
    end

to_css(options={}) click to toggle source

    # File lib/csspool/node.rb, line 31
    def to_css options={}
      if options[:minify]
        to_minified_css
      else
        accept Visitors::ToCSS.new
      end
    end

Also aliased as: to_s
to_minified_css() click to toggle source

    # File lib/csspool/node.rb, line 40
    def to_minified_css
      accept Visitors::ToMinifiedCSS.new
    end

to_s(options={}) click to toggle source
Alias for: to_css

[Validate]

Generated with the Darkfish Rdoc Generator 2.