Class: Sass::Value::Function

Inherits:
Object
  • Object
show all
Includes:
Sass::Value
Defined in:
lib/sass/value/function.rb

Overview

Sass’s function type.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Sass::Value

#[], #assert_boolean, #assert_calculation, #assert_color, #assert_map, #assert_mixin, #assert_number, #assert_string, #at, #bracketed?, #eql?, #sass_index_to_array_index, #separator, #to_a, #to_bool, #to_map, #to_nil

Constructor Details

#initialize(signature, &callback) ⇒ Function

Returns a new instance of Function.

Parameters:

  • signature (::String)
  • callback (Proc)

Raises:



13
14
15
16
17
18
# File 'lib/sass/value/function.rb', line 13

def initialize(signature, &callback)
  raise Sass::ScriptError, 'no block given' unless signature.nil? || callback

  @signature = signature.freeze
  @callback = callback.freeze
end

Instance Attribute Details

#callbackProc? (readonly)

Returns:

  • (Proc, nil)


27
28
29
# File 'lib/sass/value/function.rb', line 27

def callback
  @callback
end

#signature::String? (readonly)

Returns:

  • (::String, nil)


24
25
26
# File 'lib/sass/value/function.rb', line 24

def signature
  @signature
end

Instance Method Details

#==(other) ⇒ ::Boolean

Returns:

  • (::Boolean)


30
31
32
33
34
35
36
# File 'lib/sass/value/function.rb', line 30

def ==(other)
  if id.nil?
    other.equal?(self)
  else
    other.is_a?(Sass::Value::Function) && other.id == id
  end
end

#assert_function(_name = nil) ⇒ Function

Returns:



44
45
46
# File 'lib/sass/value/function.rb', line 44

def assert_function(_name = nil)
  self
end

#hashInteger

Returns:

  • (Integer)


39
40
41
# File 'lib/sass/value/function.rb', line 39

def hash
  @hash ||= id.nil? ? signature.hash : id.hash
end