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