Module: Orchestrator::Constants

Defined in:
lib/orchestrator/utilities/constants.rb

Constant Summary collapse

On =

On is active

true
Off =

Off is inactive

false
Down =

Down is usually active (projector screen for instance)

true
Up =

Up is usually inactive

false
Open =
true
Close =
false
Short =
false
On_vars =
Set.new([1, true, 'true', 'True', 
:on, :On, 'on', 'On', 
:yes, :Yes, 'yes', 'Yes', 
'down', 'Down', :down, :Down, 
'open', 'Open', :open, :Open,
'active', 'Active', :active, :Active])
Off_vars =
Set.new([0, false, 'false', 'False',
:off, :Off, 'off', 'Off', 
:no, :No, 'no', 'No',
'up', 'Up', :up, :Up,
'close', 'Close', :close, :Close,
'short', 'Short', :short, :Short,
'inactive', 'Inactive', :inactive, :Inactive])

Instance Method Summary collapse

Instance Method Details

#in_range(num, max, min = 0) ⇒ Object



29
30
31
32
33
# File 'lib/orchestrator/utilities/constants.rb', line 29

def in_range(num, max, min = 0)
    num = min if num < min
    num = max if num > max
    num
end

#is_affirmative?(val) ⇒ Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/orchestrator/utilities/constants.rb', line 35

def is_affirmative?(val)
    On_vars.include?(val)
end

#is_negatory?(val) ⇒ Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/orchestrator/utilities/constants.rb', line 39

def is_negatory?(val)
    Off_vars.include?(val)
end