Module: RSMP::TLC::Modules::Helpers

Included in:
TrafficController
Defined in:
lib/rsmp/tlc/modules/helpers.rb

Overview

Utility helper methods

Instance Method Summary collapse

Instance Method Details

#bool_to_digit(bool) ⇒ Object



13
14
15
# File 'lib/rsmp/tlc/modules/helpers.rb', line 13

def bool_to_digit(bool)
  bool ? '1' : '0'
end

#find_plan(plan_nr) ⇒ Object

Raises:



6
7
8
9
10
11
# File 'lib/rsmp/tlc/modules/helpers.rb', line 6

def find_plan(plan_nr)
  plan = @plans[plan_nr.to_i]
  raise InvalidMessage, "unknown signal plan #{plan_nr}, known only [#{@plans.keys.join(', ')}]" unless plan

  plan
end