Class: Dentaku::AST::Bitwise
- Defined in:
- lib/dentaku/ast/bitwise.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Operation
Instance Method Summary collapse
Methods inherited from Operation
#accept, #dependencies, #display_operator, #initialize, max_param_count, min_param_count, right_associative?
Methods inherited from Node
arity, #dependencies, #name, precedence, resolve_class, #type
Constructor Details
This class inherits a constructor from Dentaku::AST::Operation
Instance Method Details
#value(context = {}) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/dentaku/ast/bitwise.rb', line 6 def value(context = {}) left_value = left.value(context) right_value = right.value(context) left_value.public_send(operator, right_value) rescue NoMethodError => e raise Dentaku::ArgumentError.for(:invalid_operator, value: left_value, for: left_value.class) rescue TypeError => e raise Dentaku::ArgumentError.for(:invalid_operator, value: right_value, for: right_value.class) end |