Class: Dotman::Shell::Comparison
- Inherits:
-
Object
- Object
- Dotman::Shell::Comparison
- Defined in:
- lib/dotman/shell/comparison.rb
Instance Method Summary collapse
-
#initialize(operand1, operator, operand2 = nil) ⇒ Comparison
constructor
A new instance of Comparison.
- #to_s ⇒ Object
Constructor Details
#initialize(operand1, operator, operand2 = nil) ⇒ Comparison
Returns a new instance of Comparison.
3 4 5 |
# File 'lib/dotman/shell/comparison.rb', line 3 def initialize(operand1, operator, operand2 = nil) @operand1, @operator, @operand2 = operand1, operator, operand2 end |
Instance Method Details
#to_s ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/dotman/shell/comparison.rb', line 7 def to_s if @operand2.nil? '[ %s "%s" ]' % [@operator, @operand1] else '[ "%s" %s "%s" ]' % [ @operand1, @operator, @operand2 ] end end |