Class: Cmdlet::Comparison::Eq

Inherits:
BaseCmdlet show all
Defined in:
lib/cmdlet/comparison/eq.rb

Overview

Eq: Return true if two values are equal

Instance Method Summary collapse

Methods inherited from BaseCmdlet

#tokenizer

Instance Method Details

#call(lhs, rhs) ⇒ String

Return truthy value if left hand side equals right hand side

Parameters:

  • lhs (Object)
    • lhs - left hand side value

  • rhs (Object)
    • rhs - right hand side value

Returns:

  • (String)

    return truthy value if left hand side equals right hand side



12
13
14
15
16
17
# File 'lib/cmdlet/comparison/eq.rb', line 12

def call(lhs, rhs)
  lhs = lhs.to_s if lhs.is_a?(Symbol)
  rhs = rhs.to_s if rhs.is_a?(Symbol)

  lhs == rhs
end