Class: ORTools::Constant
- Inherits:
-
Expression
- Object
- Expression
- ORTools::Constant
- Defined in:
- lib/or_tools/constant.rb
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Attributes included from ExpressionMethods
Instance Method Summary collapse
-
#+(other) ⇒ Object
simplify Ruby sum.
- #-@ ⇒ Object
-
#initialize(value) ⇒ Constant
constructor
A new instance of Constant.
- #inspect ⇒ Object
- #vars ⇒ Object
Methods inherited from Expression
Methods included from ExpressionMethods
#!=, #*, #-, #<, #<=, #==, #>, #>=, #coerce, #to_s
Constructor Details
#initialize(value) ⇒ Constant
Returns a new instance of Constant.
5 6 7 |
# File 'lib/or_tools/constant.rb', line 5 def initialize(value) @value = value end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
3 4 5 |
# File 'lib/or_tools/constant.rb', line 3 def value @value end |
Instance Method Details
#+(other) ⇒ Object
simplify Ruby sum
10 11 12 |
# File 'lib/or_tools/constant.rb', line 10 def +(other) @value == 0 ? other : super end |
#inspect ⇒ Object
14 15 16 |
# File 'lib/or_tools/constant.rb', line 14 def inspect @value.to_s end |
#vars ⇒ Object
22 23 24 |
# File 'lib/or_tools/constant.rb', line 22 def vars @vars ||= [] end |