Class: ProconBypassMan::Procon::MacroBuilder::Subject

Inherits:
Object
  • Object
show all
Defined in:
lib/procon_bypass_man/procon/macro_builder.rb

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ Subject

Returns a new instance of Subject.



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/procon_bypass_man/procon/macro_builder.rb', line 19

def initialize(value)
  if not /^shake_/ =~ value
    @button =
      if match = value.match(/_(\w+)\z/)
        match[1]
      else
        :unknown
      end
  end
  @type =
    if value.start_with?("toggle_")
      :toggle
    elsif value.start_with?("shake_left_stick")
      :shake_left_stick
    else
      :pressing
    end
end

Instance Method Details

#to_stepsObject



38
39
40
41
42
43
44
45
46
47
# File 'lib/procon_bypass_man/procon/macro_builder.rb', line 38

def to_steps
  case @type
  when :toggle
    [@button.to_sym, :none]
  when :pressing
    [@button.to_sym, @button.to_sym]
  when :shake_left_stick
    [:tilt_left_stick_completely_to_left, :tilt_left_stick_completely_to_right]
  end
end