### Home Classes Methods

### In Files

- lib/sass/script/node.rb

### Parent

Object

### Methods

- #_perform
- #children
- #dasherize
- #deep_copy
- #options=
- #opts
- #perform
- #to_sass

### Class/Module Index

Quicksearch

- Sass
- Sass::CSS
- Sass::CacheStores
- Sass::CacheStores::Base
- Sass::CacheStores::Chain
- Sass::CacheStores::Filesystem
- Sass::CacheStores::Memory
- Sass::CacheStores::Null
- Sass::Callbacks
- Sass::Callbacks::InstanceMethods
- Sass::Engine
- Sass::Engine::Line
- Sass::Environment
- Sass::Exec
- Sass::Exec::Generic
- Sass::Exec::Sass
- Sass::Exec::SassConvert
- Sass::Exec::Scss
- Sass::Importers
- Sass::Importers::Base
- Sass::Importers::Filesystem
- Sass::Logger
- Sass::Logger::Base
- Sass::Logger::LogLevel
- Sass::Logger::LogLevel::ClassMethods
- Sass::Media
- Sass::Media::Query
- Sass::Media::QueryList
- Sass::Plugin
- Sass::Plugin::Compiler
- Sass::Plugin::Configuration
- Sass::Plugin::MerbBootLoader
- Sass::Plugin::Rack
- Sass::Plugin::StalenessChecker
- Sass::Repl
- Sass::SCSS
- Sass::SCSS::CssParser
- Sass::SCSS::Parser
- Sass::SCSS::RX
- Sass::SCSS::ScriptLexer
- Sass::SCSS::ScriptParser
- Sass::SCSS::StaticParser
- Sass::Script
- Sass::Script::ArgList
- Sass::Script::Bool
- Sass::Script::Color
- Sass::Script::CssLexer
- Sass::Script::CssParser
- Sass::Script::Funcall
- Sass::Script::Functions
- Sass::Script::Functions::EvaluationContext
- Sass::Script::Interpolation
- Sass::Script::Lexer
- Sass::Script::List
- Sass::Script::Literal
- Sass::Script::Node
- Sass::Script::Null
- Sass::Script::Number
- Sass::Script::Operation
- Sass::Script::Parser
- Sass::Script::String
- Sass::Script::StringInterpolation
- Sass::Script::UnaryOperation
- Sass::Script::Variable
- Sass::Selector
- Sass::Selector::AbstractSequence
- Sass::Selector::Attribute
- Sass::Selector::Class
- Sass::Selector::CommaSequence
- Sass::Selector::Element
- Sass::Selector::Id
- Sass::Selector::Interpolation
- Sass::Selector::Parent
- Sass::Selector::Placeholder
- Sass::Selector::Pseudo
- Sass::Selector::SelectorPseudoClass
- Sass::Selector::Sequence
- Sass::Selector::Simple
- Sass::Selector::SimpleSequence
- Sass::Selector::Universal
- Sass::Shared
- Sass::Supports
- Sass::Supports::Condition
- Sass::Supports::Declaration
- Sass::Supports::Interpolation
- Sass::Supports::Negation
- Sass::Supports::Operator
- Sass::SyntaxError
- Sass::Tree
- Sass::Tree::CharsetNode
- Sass::Tree::CommentNode
- Sass::Tree::ContentNode
- Sass::Tree::CssImportNode
- Sass::Tree::DebugNode
- Sass::Tree::DirectiveNode
- Sass::Tree::EachNode
- Sass::Tree::ExtendNode
- Sass::Tree::ForNode
- Sass::Tree::FunctionNode
- Sass::Tree::IfNode
- Sass::Tree::ImportNode
- Sass::Tree::MediaNode
- Sass::Tree::MixinDefNode
- Sass::Tree::MixinNode
- Sass::Tree::Node
- Sass::Tree::PropNode
- Sass::Tree::ReturnNode
- Sass::Tree::RootNode
- Sass::Tree::RuleNode
- Sass::Tree::SupportsNode
- Sass::Tree::TraceNode
- Sass::Tree::VariableNode
- Sass::Tree::Visitors
- Sass::Tree::Visitors::Base
- Sass::Tree::Visitors::CheckNesting
- Sass::Tree::Visitors::Convert
- Sass::Tree::Visitors::Cssize
- Sass::Tree::Visitors::DeepCopy
- Sass::Tree::Visitors::Extend
- Sass::Tree::Visitors::Perform
- Sass::Tree::Visitors::SetOptions
- Sass::Tree::Visitors::ToCss
- Sass::Tree::WarnNode
- Sass::Tree::WhileNode
- Sass::UnitConversionError
- Sass::Util
- Sass::Util::MultibyteStringScanner
- Sass::Util::StaticConditionalContext
- Sass::Util::SubsetMap
- Sass::Util::Test
- Sass::Version
- ActionController
- ActionController::Base
- Object

No matching classes.

# Sass::Script::Node

The abstract superclass for SassScript parse tree nodes.

Use {#perform} to evaluate a parse tree.

### Attributes

line[RW]

The line of the document on which this node appeared.

@return [Fixnum]

options[R]

The options hash for this node.

@return [{Symbol => Object}]

### Public Instance Methods

children() click to toggle source

Returns all child nodes of this node.

@return [Array<Node>]

    # File lib/sass/script/node.rb, line 49
    def children
      Sass::Util.abstract(self)
    end

deep_copy() click to toggle source

Returns a deep clone of this node. The child nodes are cloned, but options are not.

@return [Node]

    # File lib/sass/script/node.rb, line 64
    def deep_copy
      Sass::Util.abstract(self)
    end

options=(options) click to toggle source

Sets the options hash for this node, as well as for all child nodes. See {file:SASS_REFERENCE.md#sass_options the Sass options documentation}.

@param options [{Symbol => Object}] The options

    # File lib/sass/script/node.rb, line 21
    def options=(options)
      @options = options
      children.each do |c|
        if c.is_a? Hash
          c.values.each {|v| v.options = options }
        else
          c.options = options
        end
      end
    end

perform(environment) click to toggle source

Evaluates the node.

{#perform} shouldn't be overridden directly; instead, override {#_perform}.

@param environment [Sass::Environment] The environment in which to evaluate the SassScript @return [Literal] The SassScript object that is the value of the SassScript

    # File lib/sass/script/node.rb, line 39
    def perform(environment)
      _perform(environment)
    rescue Sass::SyntaxError => e
      e.modify_backtrace(:line => line)
      raise e
    end

to_sass(opts = {}) click to toggle source

Returns the text of this SassScript expression.

@return [String]

    # File lib/sass/script/node.rb, line 56
    def to_sass(opts = {})
      Sass::Util.abstract(self)
    end

### Protected Instance Methods

_perform(environment) click to toggle source

Evaluates this node. Note that all {Literal} objects created within this method should have their {#options} attribute set, probably via {#opts}.

@param environment [Sass::Environment] The environment in which to evaluate the SassScript @return [Literal] The SassScript object that is the value of the SassScript @see perform

    # File lib/sass/script/node.rb, line 86
    def _perform(environment)
      Sass::Util.abstract(self)
    end

dasherize(s, opts) click to toggle source

Converts underscores to dashes if the :dasherize option is set.

    # File lib/sass/script/node.rb, line 71
    def dasherize(s, opts)
      if opts[:dasherize]
        s.gsub(/_/,'-')
      else
        s
      end
    end

opts(literal) click to toggle source

Sets the {#options} field on the given literal and returns it

@param literal [Literal] @return [Literal]

    # File lib/sass/script/node.rb, line 94
    def opts(literal)
      literal.options = options
      literal
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.