Sha256: e1e6d014dea18cf786273149e6d075861167d67953e375a78ba674b798f208ee
Contents?: true
Size: 1.36 KB
Versions: 1
Compression:
Stored size: 1.36 KB
Contents
require 'set' module Orchestrator module Constants On = true # On is active Off = false # Off is inactive Down = true # Down is usually active (projector screen for instance) Up = false # Up is usually inactive 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]) def in_range(num, max, min = 0) num = min if num < min num = max if num > max num end def is_affirmative?(val) On_vars.include?(val) end def is_negatory?(val) Off_vars.include?(val) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
orchestrator-1.0.3 | lib/orchestrator/utilities/constants.rb |