Class: ProconBypassMan::PressButtonAware
- Inherits:
-
Object
- Object
- ProconBypassMan::PressButtonAware
- Defined in:
- lib/procon_bypass_man/procon/press_button_aware.rb
Constant Summary collapse
- BIT_ON =
'1'.freeze
Instance Method Summary collapse
-
#initialize(binary) ⇒ PressButtonAware
constructor
A new instance of PressButtonAware.
- #pressing_button?(button) ⇒ Boolean
Constructor Details
#initialize(binary) ⇒ PressButtonAware
Returns a new instance of PressButtonAware.
4 5 6 |
# File 'lib/procon_bypass_man/procon/press_button_aware.rb', line 4 def initialize(binary) @binary = binary end |
Instance Method Details
#pressing_button?(button) ⇒ Boolean
10 11 12 13 14 |
# File 'lib/procon_bypass_man/procon/press_button_aware.rb', line 10 def () = ProconBypassMan::Procon::Button.new() byte = @binary[.byte_position].unpack("C").first.to_s(2).reverse byte[.bit_position] == BIT_ON end |