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)


29
30
31
# File 'lib/sass/value/function.rb', line 29

def callback
  @callback
end

#signature::String? (readonly)

Returns:

  • (::String, nil)


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

def signature
  @signature
end

Instance Method Details

#==(other) ⇒ ::Boolean

Returns:

  • (::Boolean)


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

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:



46
47
48
# File 'lib/sass/value/function.rb', line 46

def assert_function(_name = nil)
  self
end

#hashInteger

Returns:

  • (Integer)


41
42
43
# File 'lib/sass/value/function.rb', line 41

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