module ProconBypassMan::Procon::LayerChangeable

Public Instance Methods

change_layer?() click to toggle source
# File lib/procon_bypass_man/procon/layer_changeable.rb, line 18
def change_layer?
  if ProconBypassMan::Configuration.instance.prefix_keys.empty?
    raise "prefix_keysが未設定です"
  end
  ProconBypassMan::Configuration.instance.prefix_keys.map { |b| pressed_button?(b) }.all?
end
next_layer_key() click to toggle source
# File lib/procon_bypass_man/procon/layer_changeable.rb, line 2
def next_layer_key
  case
  when pressed_up?
    :up
  when pressed_right?
    :right
  when pressed_left?
    :left
  when pressed_down?
    :down
  else
    ProconBypassMan.logger.warn("next_layer_key is unknown")
    :up
  end
end
pressed_next_layer?() click to toggle source
# File lib/procon_bypass_man/procon/layer_changeable.rb, line 25
def pressed_next_layer?
  change_layer? && (pressed_up? || pressed_right? || pressed_left? || pressed_down?)
end