gems.sass-3.2.9.lib.sass.script.literal.rb Maven / Gradle / Ivy
Go to download
Sass makes CSS fun again. Sass is an extension of CSS3, adding nested rules, variables, mixins, selector
inheritance, and more. It's translated to well-formatted, standard CSS using the command line tool or a
web-framework plugin.
This is a repackaged GEM in a JAR format of the sass-lang.gem package. The sass-gems package version
follows the sass-lang.gem versions located http://rubyforge.org/frs/?group_id=9702. Simply change
the version of this package to download and repackage the same GEM version.
The newest version!
module Sass::Script
# 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.
class Literal < Node
require 'sass/script/string'
require 'sass/script/number'
require 'sass/script/color'
require 'sass/script/bool'
require 'sass/script/null'
require 'sass/script/list'
require 'sass/script/arg_list'
# Returns the Ruby value of the literal.
# The type of this value varies based on the subclass.
#
# @return [Object]
attr_reader :value
# Creates a new literal.
#
# @param value [Object] The object for \{#value}
def initialize(value = nil)
@value = value
super()
end
# Returns an empty array.
#
# @return [Array] empty
# @see Node#children
def children
[]
end
# @see Node#deep_copy
def deep_copy
dup
end
# 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 literal was created
# outside of the parser and \{#to\_s} was called on it
def options
opts = super
return opts if opts
raise Sass::SyntaxError.new(<] The of this literal as a list
def to_a
[self]
end
# Returns the string representation of this literal
# as it would be output to the CSS document.
#
# @return [String]
def to_s(opts = {})
raise Sass::SyntaxError.new("[BUG] All subclasses of Sass::Literal must implement #to_s.")
end
alias_method :to_sass, :to_s
# Returns whether or not this object is null.
#
# @return [Boolean] `false`
def null?
false
end
protected
# Evaluates the literal.
#
# @param environment [Sass::Environment] The environment in which to evaluate the SassScript
# @return [Literal] This literal
def _perform(environment)
self
end
end
end