Class: Ban::IrEvent
Constant Summary collapse
- CMD =
0x36
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
Class Method Summary collapse
Instance Method Summary collapse
- #hex ⇒ Object
-
#initialize(code) ⇒ IrEvent
constructor
A new instance of IrEvent.
- #name ⇒ Object
- #to_hash ⇒ Object
- #to_s ⇒ Object
Methods inherited from Event
Constructor Details
#initialize(code) ⇒ IrEvent
Returns a new instance of IrEvent.
11 12 13 |
# File 'lib/ban/events/ir_event.rb', line 11 def initialize(code) @code = code end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
5 6 7 |
# File 'lib/ban/events/ir_event.rb', line 5 def code @code end |
Class Method Details
.parse(data) ⇒ Object
7 8 9 |
# File 'lib/ban/events/ir_event.rb', line 7 def self.parse(data) new(Ban.decode7bit(data).to_i) end |
Instance Method Details
#hex ⇒ Object
19 20 21 |
# File 'lib/ban/events/ir_event.rb', line 19 def hex code.to_s(16) end |
#name ⇒ Object
15 16 17 |
# File 'lib/ban/events/ir_event.rb', line 15 def name 'ir-received' end |
#to_hash ⇒ Object
23 24 25 |
# File 'lib/ban/events/ir_event.rb', line 23 def to_hash { 'code' => @code, 'hex' => hex } end |
#to_s ⇒ Object
27 28 29 |
# File 'lib/ban/events/ir_event.rb', line 27 def to_s "#{code} (0x#{hex})" end |