Class: Sass::Script::UnaryOperation
- Defined in:
- lib/sass/script/unary_operation.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#initialize(operand, operator) ⇒ UnaryOperation
constructor
A new instance of UnaryOperation.
- #inspect ⇒ Object
- #perform(environment) ⇒ Object
Constructor Details
#initialize(operand, operator) ⇒ UnaryOperation
Returns a new instance of UnaryOperation.
3 4 5 6 |
# File 'lib/sass/script/unary_operation.rb', line 3 def initialize(operand, operator) @operand = operand @operator = operator end |
Instance Method Details
#inspect ⇒ Object
8 9 10 |
# File 'lib/sass/script/unary_operation.rb', line 8 def inspect "(#{@operator.inspect} #{@operand.inspect})" end |
#perform(environment) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/sass/script/unary_operation.rb', line 12 def perform(environment) operator = "unary_#{@operator}" literal = @operand.perform(environment) literal.send(operator) rescue NoMethodError => e raise e unless e.name.to_s == operator.to_s raise Sass::SyntaxError.new("Undefined unary operation: \"#{@operator} #{literal}\".") end |