Class: Sass::Script::Tree::Node

### Home Classes Methods

### In Files

- lib/sass/script/tree/node.rb

### Parent

Object

### Methods

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

### Class/Module Index

Quicksearch

- Sass
- Sass::BaseEnvironment
- 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::Base
- Sass::Exec::SassConvert
- Sass::Exec::SassScss
- Sass::Exec::SassScss::Sass::Plugin.compiler
- Sass::Features
- 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::ReadOnlyEnvironment
- 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::CssLexer
- Sass::Script::CssParser
- Sass::Script::Functions
- Sass::Script::Functions::EvaluationContext
- Sass::Script::Lexer
- Sass::Script::Parser
- Sass::Script::Tree
- Sass::Script::Tree::Funcall
- Sass::Script::Tree::Interpolation
- Sass::Script::Tree::ListLiteral
- Sass::Script::Tree::Literal
- Sass::Script::Tree::MapLiteral
- Sass::Script::Tree::Node
- Sass::Script::Tree::Operation
- Sass::Script::Tree::Selector
- Sass::Script::Tree::StringInterpolation
- Sass::Script::Tree::UnaryOperation
- Sass::Script::Tree::Variable
- Sass::Script::Value
- Sass::Script::Value::ArgList
- Sass::Script::Value::Base
- Sass::Script::Value::Bool
- Sass::Script::Value::Color
- Sass::Script::Value::Helpers
- Sass::Script::Value::List
- Sass::Script::Value::Map
- Sass::Script::Value::Null
- Sass::Script::Value::Number
- Sass::Selector
- Sass::Selector::AbstractSequence
- Sass::Selector::Attribute
- Sass::Selector::Class
- Sass::Selector::CommaSequence
- Sass::Selector::Element
- Sass::Selector::Id
- Sass::Selector::Parent
- Sass::Selector::Placeholder
- Sass::Selector::Pseudo
- Sass::Selector::Sequence
- Sass::Selector::Simple
- Sass::Selector::SimpleSequence
- Sass::Selector::Universal
- Sass::SemiGlobalEnvironment
- Sass::Shared
- Sass::Source
- Sass::Source::Map
- Sass::Source::Map::Mapping
- Sass::Source::Position
- Sass::Source::Range
- Sass::Stack
- Sass::Stack::Frame
- Sass::Supports
- Sass::Supports::Condition
- Sass::Supports::Declaration
- Sass::Supports::Interpolation
- Sass::Supports::Negation
- Sass::Supports::Operator
- Sass::SyntaxError
- Sass::Tree
- Sass::Tree::AtRootNode
- Sass::Tree::CharsetNode
- Sass::Tree::CommentNode
- Sass::Tree::ContentNode
- Sass::Tree::CssImportNode
- Sass::Tree::DebugNode
- Sass::Tree::DirectiveNode
- Sass::Tree::EachNode
- Sass::Tree::ErrorNode
- Sass::Tree::ExtendNode
- Sass::Tree::ForNode
- Sass::Tree::FunctionNode
- Sass::Tree::IfNode
- Sass::Tree::ImportNode
- Sass::Tree::KeyframeRuleNode
- 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::Cssize::Bubble
- 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::CrossPlatformRandom
- Sass::Util::MultibyteStringScanner
- Sass::Util::NormalizedMap
- Sass::Util::SubsetMap
- Sass::Util::Test
- Sass::Version
- ActionController
- ActionController::Base
- Object
- OrderedHash

No matching classes.

# Sass::Script::Tree::Node

The abstract superclass for SassScript parse tree nodes.

Use {#perform} to evaluate a parse tree.

### Attributes

filename[RW]

The file name of the document on which this node appeared.

@return [String]

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}]

source_range[RW]

The source range in the document on which this node appeared.

@return [Sass::Source::Range]

### Public Instance Methods

children() click to toggle source

Returns all child nodes of this node.

@return [Array<Node>]

    # File lib/sass/script/tree/node.rb, line 59
    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/tree/node.rb, line 74
    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/tree/node.rb, line 31
    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 [Sass::Script::Value] The SassScript object that is the value of the SassScript

    # File lib/sass/script/tree/node.rb, line 49
    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/tree/node.rb, line 66
    def to_sass(opts = {})
      Sass::Util.abstract(self)
    end

### Protected Instance Methods

_perform(environment) click to toggle source

Evaluates this node. Note that all {Sass::Script::Value} 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 [Sass::Script::Value] The SassScript object that is the value of the SassScript @see perform

    # File lib/sass/script/tree/node.rb, line 96
    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/tree/node.rb, line 81
    def dasherize(s, opts)
      if opts[:dasherize]
        s.gsub(/_/, '-')
      else
        s
      end
    end

opts(value) click to toggle source

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

@param value [Sass::Script::Value] @return [Sass::Script::Value]

    # File lib/sass/script/tree/node.rb, line 104
    def opts(value)
      value.options = options
      value
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.