Class: ORTools::Expression
- Inherits:
-
Object
- Object
- ORTools::Expression
- Includes:
- ExpressionMethods
- Defined in:
- lib/or_tools/expression.rb
Instance Attribute Summary
Attributes included from ExpressionMethods
Class Method Summary collapse
-
.to_expression(other) ⇒ Object
private.
Instance Method Summary collapse
-
#initialize(parts = []) ⇒ Expression
constructor
A new instance of Expression.
Methods included from ExpressionMethods
#!=, #*, #+, #-, #-@, #<, #<=, #==, #>, #>=, #coerce, #inspect, #to_s, #vars
Constructor Details
#initialize(parts = []) ⇒ Expression
Returns a new instance of Expression.
70 71 72 |
# File 'lib/or_tools/expression.rb', line 70 def initialize(parts = []) @parts = parts end |
Class Method Details
.to_expression(other) ⇒ Object
private
75 76 77 78 79 80 81 82 83 |
# File 'lib/or_tools/expression.rb', line 75 def self.to_expression(other) if other.is_a?(Numeric) Constant.new(other) elsif other.is_a?(Variable) || other.is_a?(Expression) other else raise TypeError, "can't cast #{other.class.name} to Expression" end end |