Class: Huebot::Compiler::ApiV1
- Inherits:
-
Object
- Object
- Huebot::Compiler::ApiV1
- Defined in:
- lib/huebot/compiler/api_v1.rb
Constant Summary collapse
- DEVICE_REF =
/\A\$([1-9][0-9]*)\Z/.freeze
- TRANSITION_KEYS =
["transition"].freeze
- SERIAL_KEYS =
["serial"].freeze
- PARALLEL_KEYS =
["parallel"].freeze
- INFINITE_KEYS =
["infinite"].freeze
- COUNT_KEYS =
["count"].freeze
- TIMER_KEYS =
["timer"].freeze
- DEADLINE_KEYS =
["until"].freeze
- HHMM =
/\A[0-9]{2}:[0-9]{2}\Z/.freeze
- PERCENT_CAPTURE =
/\A([0-9]+)%\Z/.freeze
- MIN_KELVIN =
2000- MAX_KELVIN =
6530- MAX_BRI =
254
Instance Method Summary collapse
- #build(tokens, default_name = nil) ⇒ Huebot::Program
-
#initialize(api_version) ⇒ ApiV1
constructor
A new instance of ApiV1.
Constructor Details
#initialize(api_version) ⇒ ApiV1
Returns a new instance of ApiV1.
21 22 23 |
# File 'lib/huebot/compiler/api_v1.rb', line 21 def initialize(api_version) @api_version = api_version end |
Instance Method Details
#build(tokens, default_name = nil) ⇒ Huebot::Program
26 27 28 29 30 31 32 |
# File 'lib/huebot/compiler/api_v1.rb', line 26 def build(tokens, default_name = nil) prog = Program.new prog.name = tokens.delete("name") || default_name prog.api_version = @api_version prog.data = node tokens.dup prog end |