Class: Sass::CalculationValue::CalculationOperation
- Inherits:
-
Object
- Object
- Sass::CalculationValue::CalculationOperation
show all
- Includes:
- Sass::CalculationValue
- Defined in:
- lib/sass/calculation_value/calculation_operation.rb
Overview
A binary operation that can appear in a SassCalculation.
Instance Attribute Summary collapse
Instance Method Summary
collapse
#assert_calculation_value
Constructor Details
Returns a new instance of CalculationOperation.
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/sass/calculation_value/calculation_operation.rb', line 18
def initialize(operator, left, right)
raise Sass::ScriptError, "Invalid operator: #{operator}" unless OPERATORS.include?(operator)
left.assert_calculation_value
right.assert_calculation_value
@operator = operator.freeze
@left = left.freeze
@right = right.freeze
end
|
Instance Attribute Details
33
34
35
|
# File 'lib/sass/calculation_value/calculation_operation.rb', line 33
def left
@left
end
|
#operator ⇒ ::String
30
31
32
|
# File 'lib/sass/calculation_value/calculation_operation.rb', line 30
def operator
@operator
end
|
36
37
38
|
# File 'lib/sass/calculation_value/calculation_operation.rb', line 36
def right
@right
end
|
Instance Method Details
#==(other) ⇒ ::Boolean
39
40
41
42
43
44
|
# File 'lib/sass/calculation_value/calculation_operation.rb', line 39
def ==(other)
other.is_a?(Sass::CalculationValue::CalculationOperation) &&
other.operator == operator &&
other.left == left &&
other.right == right
end
|
#hash ⇒ Integer
47
48
49
|
# File 'lib/sass/calculation_value/calculation_operation.rb', line 47
def hash
@hash ||= [operator, left, right].hash
end
|