Class: Dotman::Shell::Comparison

Inherits:
Object
  • Object
show all
Defined in:
lib/dotman/shell/comparison.rb

Instance Method Summary collapse

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_sObject



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