Sha256: 3f497e7b5d7095d0e7e3d869bf1fe60525b3a3e5f047c1391450383c4d925821

Contents?: true

Size: 383 Bytes

Versions: 29

Compression:

Stored size: 383 Bytes

Contents

class ProconBypassMan::PressButtonAware
  BIT_ON = '1'.freeze

  def initialize(binary)
    @binary = binary
  end

  # @param [Symbol]
  # @return [Boolean]
  def pressing_button?(button)
    button_obj = ProconBypassMan::Procon::Button.new(button)
    byte = @binary[button_obj.byte_position].unpack("C").first.to_s(2).reverse
    byte[button_obj.bit_position] == BIT_ON
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
procon_bypass_man-0.3.12 lib/procon_bypass_man/procon/press_button_aware.rb
procon_bypass_man-0.3.11 lib/procon_bypass_man/procon/press_button_aware.rb
procon_bypass_man-0.3.10 lib/procon_bypass_man/procon/press_button_aware.rb
procon_bypass_man-0.3.9 lib/procon_bypass_man/procon/press_button_aware.rb
procon_bypass_man-0.3.8.1 lib/procon_bypass_man/procon/press_button_aware.rb
procon_bypass_man-0.3.8 lib/procon_bypass_man/procon/press_button_aware.rb
procon_bypass_man-0.3.7 lib/procon_bypass_man/procon/press_button_aware.rb
procon_bypass_man-0.3.6 lib/procon_bypass_man/procon/press_button_aware.rb
procon_bypass_man-0.3.5 lib/procon_bypass_man/procon/press_button_aware.rb
procon_bypass_man-0.3.4 lib/procon_bypass_man/procon/press_button_aware.rb
procon_bypass_man-0.3.3.1 lib/procon_bypass_man/procon/press_button_aware.rb
procon_bypass_man-0.3.3 lib/procon_bypass_man/procon/press_button_aware.rb
procon_bypass_man-0.3.2 lib/procon_bypass_man/procon/press_button_aware.rb
procon_bypass_man-0.3.1 lib/procon_bypass_man/procon/press_button_aware.rb
procon_bypass_man-0.3.0 lib/procon_bypass_man/procon/press_button_aware.rb
procon_bypass_man-0.2.3 lib/procon_bypass_man/procon/press_button_aware.rb
procon_bypass_man-0.2.2 lib/procon_bypass_man/procon/press_button_aware.rb
procon_bypass_man-0.2.1 lib/procon_bypass_man/procon/press_button_aware.rb
procon_bypass_man-0.2.0 lib/procon_bypass_man/procon/press_button_aware.rb
procon_bypass_man-0.1.23 lib/procon_bypass_man/procon/press_button_aware.rb