Class: OutputReportGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/procon_bypass_man/support/output_report_generator.rb

Constant Summary collapse

NO_ACTION =
["30f28100800078c77448287509550274ff131029001b0022005a0271ff191028001e00210064027cff1410280020002100000000000000000000000000000000"].pack("H*").freeze

Instance Method Summary collapse

Constructor Details

#initialize(*pressed_buttons) ⇒ OutputReportGenerator

Returns a new instance of OutputReportGenerator.

Parameters:

  • pressed_buttons (Array<Symbol, String>, NilClass)


5
6
7
# File 'lib/procon_bypass_man/support/output_report_generator.rb', line 5

def initialize(*pressed_buttons)
  @buttons = pressed_buttons || []
end

Instance Method Details

#executeString

Returns:

  • (String)


10
11
12
13
14
15
16
17
# File 'lib/procon_bypass_man/support/output_report_generator.rb', line 10

def execute
  user_operation = ProconBypassMan::Procon::UserOperation.new(NO_ACTION.dup)
  [@buttons].flatten.sort.uniq.each do |button|
    user_operation.press_button(button.to_sym)
  end

  user_operation.binary.unpack.first
end