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_number, #assert_string, #at, #bracketed?, #eql?, #sass_index_to_array_index, #separator, #to_a, #to_bool, #to_map, #to_nil

Constructor Details

#initialize(id_or_signature, callback = nil) ⇒ Function

Returns a new instance of Function.

Parameters:

  • id_or_signature (Numeric, ::String)
  • callback (Proc) (defaults to: nil)


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

def initialize(id_or_signature, callback = nil)
  if id_or_signature.is_a? Numeric
    @id = id_or_signature
  else
    @signature = id_or_signature
    @callback = callback
  end
end

Instance Attribute Details

#callbackProc? (readonly)

Returns:

  • (Proc, nil)


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

def callback
  @callback
end

#idInteger? (readonly)

Returns:

  • (Integer, nil)


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

def id
  @id
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
  id.nil? ? signature.hash : id.hash
end