All Downloads are FREE. Search and download functionalities are using the official Maven repository.

haml-3.0.25.lib.sass.script.literal.rb Maven / Gradle / Ivy

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'

    # 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

    # 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(<




© 2015 - 2025 Weber Informatics LLC | Privacy Policy