Class: Radiosonde::DSL::ComparisonOperator

Inherits:
Object
  • Object
show all
Defined in:
lib/radiosonde/dsl/comparison_operator.rb

Constant Summary collapse

ALIASES =
{
  'GreaterThanOrEqualToThreshold' => '>=',
  'GreaterThanThreshold'          => '>',
  'LessThanThreshold'             => '<',
  'LessThanOrEqualToThreshold'    => '<=',
}

Class Method Summary collapse

Class Method Details

.conv_to_alias(operator) ⇒ Object



10
11
12
# File 'lib/radiosonde/dsl/comparison_operator.rb', line 10

def conv_to_alias(operator)
  ALIASES[operator] || operator
end

.normalize(operator) ⇒ Object



18
19
20
# File 'lib/radiosonde/dsl/comparison_operator.rb', line 18

def normalize(operator)
  (ALIASES.respond_to?(:key) ? ALIASES.key(operator) : ALIASES.index(operator)) || operator
end

.valid?(operator) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/radiosonde/dsl/comparison_operator.rb', line 14

def valid?(operator)
  ALIASES.keys.include?(operator) or ALIASES.values.include?(operator)
end