Class: TimingAttack::Grouper

Inherits:
Object
  • Object
show all
Defined in:
lib/timing_attack/grouper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attacks:, group_by: {}) ⇒ Grouper

Returns a new instance of Grouper.



4
5
6
7
8
9
10
11
12
# File 'lib/timing_attack/grouper.rb', line 4

def initialize(attacks: , group_by: {})
  @attacks = attacks
  setup_grouping_opts!(group_by)
  @short_tests = []
  @long_tests = []
  group_attacks
  serialize
  freeze
end

Instance Attribute Details

#long_testsObject (readonly)

Returns the value of attribute long_tests.



3
4
5
# File 'lib/timing_attack/grouper.rb', line 3

def long_tests
  @long_tests
end

#short_testsObject (readonly)

Returns the value of attribute short_tests.



3
4
5
# File 'lib/timing_attack/grouper.rb', line 3

def short_tests
  @short_tests
end

Instance Method Details

#serializeObject



14
15
16
17
18
19
20
21
22
# File 'lib/timing_attack/grouper.rb', line 14

def serialize
  @serialize ||= {}.tap do |h|
    h[:attack_method] = test_method
    h[:attack_args]   = test_args
    h[:short]         = serialize_tests(short_tests)
    h[:long]          = serialize_tests(long_tests)
    h[:spike_delta]   = spike_delta
  end
end