Class Sass::Script::Value::Base
In: lib/sass/script/value/base.rb
Parent: Object

The abstract superclass for SassScript objects.

Many of these methods, especially the ones that correspond to SassScript operations, are designed to be overridden by subclasses which may change the semantics somewhat. The operations listed here are just the defaults.

Methods

==   _perform   assert_int!   div   eq   eql?   hash   inspect   minus   neq   new   null?   options   plus   separator   single_eq   to_a   to_bool   to_h   to_i   to_s   to_sass   unary_div   unary_minus   unary_not   unary_plus  

Attributes

options  [W]  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

source_range  [RW]  The source range in the document on which this node appeared.

@return [Sass::Source::Range]

value  [R]  Returns the Ruby value of the value. The type of this value varies based on the subclass.

@return [Object]

Public Class methods

Creates a new value.

@param value [Object] The object for \{value}

Public Instance methods

Compares this object with another.

@param other [Object] The object to compare with @return [Boolean] Whether or not this value is equivalent to `other`

@raise [Sass::SyntaxError] if this value isn‘t an integer

The SassScript `/` operation.

@param other [Value] The right-hand side of the operator @return [Script::Value::String] A string containing both values

  separated by `"/"`

The SassScript `==` operation. **Note that this returns a {Sass::Script::Value::Bool} object, not a Ruby boolean**.

@param other [Value] The right-hand side of the operator @return [Sass::Script::Value::Bool] True if this value is the same as the other,

  false otherwise

Returns the hash code of this value. Two objects’ hash codes should be equal if the objects are equal.

@return [Integer for Ruby 2.4.0+, Fixnum for earlier Ruby versions] The hash code.

@return [String] A readable representation of the value

The SassScript `-` operation.

@param other [Value] The right-hand side of the operator @return [Script::Value::String] A string containing both values

  separated by `"-"`

The SassScript `!=` operation. **Note that this returns a {Sass::Script::Value::Bool} object, not a Ruby boolean**.

@param other [Value] The right-hand side of the operator @return [Sass::Script::Value::Bool] False if this value is the same as the other,

  true otherwise

Returns whether or not this object is null.

@return [Boolean] `false`

Returns the options hash for this node.

@return [{Symbol => Object}] @raise [Sass::SyntaxError] if the options hash hasn‘t been set.

  This should only happen when the value was created
  outside of the parser and \{#to\_s} was called on it

The SassScript `+` operation.

@param other [Value] The right-hand side of the operator @return [Script::Value::String] A string containing both values

  without any separation

Returns the separator for this value. For non-list-like values or the empty list, this will be `nil`. For lists or maps, it will be `:space` or `:comma`.

@return [Symbol]

The SassScript `=` operation (used for proprietary MS syntax like `alpha(opacity=20)`).

@param other [Value] The right-hand side of the operator @return [Script::Value::String] A string containing both values

  separated by `"="`

Returns the value of this value as a list. Single values are considered the same as single-element lists.

@return [Array<Value>] This value as a list

@return [Boolean] `true` (the Ruby boolean value)

Returns the value of this value as a hash. Most values don‘t have hash representations, but [Map]s and empty [List]s do.

@return [Hash<Value, Value>] This value as a hash @raise [Sass::SyntaxError] if this value doesn‘t have a hash representation

@return [Integer] The integer value of this value @raise [Sass::SyntaxError] if this value isn‘t an integer

Returns the string representation of this value as it would be output to the CSS document.

@options opts :quote [String]

  The preferred quote style for quoted strings. If `:none`, strings are
  always emitted unquoted.

@return [String]

to_sass(opts = {})

Alias for to_s

The SassScript unary `/` operation (e.g. `/$a`).

@param other [Value] The right-hand side of the operator @return [Script::Value::String] A string containing the value

  preceded by `"/"`

The SassScript unary `-` operation (e.g. `-$a`).

@param other [Value] The right-hand side of the operator @return [Script::Value::String] A string containing the value

  preceded by `"-"`

The SassScript `==` operation. **Note that this returns a {Sass::Script::Value::Bool} object, not a Ruby boolean**.

@param other [Value] The right-hand side of the operator @return [Sass::Script::Value::Bool] True if this value is the same as the other,

  false otherwise

The SassScript unary `+` operation (e.g. `+$a`).

@param other [Value] The right-hand side of the operator @return [Script::Value::String] A string containing the value

  preceded by `"+"`

Protected Instance methods

Evaluates the value.

@param environment [Sass::Environment] The environment in which to evaluate the SassScript @return [Value] This value

[Validate]