Class: Sass::Value::Calculation
Overview
Sass’s calculation type.
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
#[], #assert_boolean, #assert_color, #assert_function, #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
Instance Attribute Details
70
71
72
|
# File 'lib/sass/value/calculation.rb', line 70
def arguments
@arguments
end
|
#name ⇒ ::String
67
68
69
|
# File 'lib/sass/value/calculation.rb', line 67
def name
@name
end
|
Class Method Details
17
18
19
|
# File 'lib/sass/value/calculation.rb', line 17
def calc(argument)
new('calc', [argument])
end
|
.clamp(min, value = nil, max = nil) ⇒ Calculation
37
38
39
40
41
42
43
44
|
# File 'lib/sass/value/calculation.rb', line 37
def clamp(min, value = nil, max = nil)
if (value.nil? && !valid_clamp_arg?(min)) ||
(max.nil? && [min, value].none? { |x| x && valid_clamp_arg?(x) })
raise Sass::ScriptError, 'Argument must be an unquoted SassString.'
end
new('clamp', [min, value, max].compact)
end
|
29
30
31
|
# File 'lib/sass/value/calculation.rb', line 29
def max(arguments)
new('max', arguments)
end
|
23
24
25
|
# File 'lib/sass/value/calculation.rb', line 23
def min(arguments)
new('min', arguments)
end
|
Instance Method Details
#==(other) ⇒ ::Boolean
78
79
80
81
82
|
# File 'lib/sass/value/calculation.rb', line 78
def ==(other)
other.is_a?(Sass::Value::Calculation) &&
other.name == name &&
other.arguments == arguments
end
|
#assert_calculation(_name = nil) ⇒ Calculation
73
74
75
|
# File 'lib/sass/value/calculation.rb', line 73
def assert_calculation(_name = nil)
self
end
|
#hash ⇒ Integer
85
86
87
|
# File 'lib/sass/value/calculation.rb', line 85
def hash
@hash ||= [name, *arguments].hash
end
|