Class: Dotman::Shell::Comparison

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

Instance Method Summary collapse

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_sObject



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