Class: ProconBypassMan::BypassMode

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

Constant Summary collapse

TYPE_NORMAL =
:normal
TYPE_AGGRESSIVE =
:aggressive
TYPES =
[TYPE_NORMAL, TYPE_AGGRESSIVE]
DEFAULT_GADGET_TO_PROCON_INTERVAL =
0.5

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(mode:, gadget_to_procon_interval:) ⇒ BypassMode

Returns a new instance of BypassMode.



17
18
19
20
# File 'lib/procon_bypass_man/procon/value_objects/bypass_mode.rb', line 17

def initialize(mode: , gadget_to_procon_interval: )
  @mode = mode.to_sym
  @gadget_to_procon_interval = gadget_to_procon_interval
end

Instance Attribute Details

#gadget_to_procon_intervalObject

Returns the value of attribute gadget_to_procon_interval.



8
9
10
# File 'lib/procon_bypass_man/procon/value_objects/bypass_mode.rb', line 8

def gadget_to_procon_interval
  @gadget_to_procon_interval
end

#modeObject

Returns the value of attribute mode.



8
9
10
# File 'lib/procon_bypass_man/procon/value_objects/bypass_mode.rb', line 8

def mode
  @mode
end

Class Method Details

.default_valueObject



10
11
12
13
14
15
# File 'lib/procon_bypass_man/procon/value_objects/bypass_mode.rb', line 10

def self.default_value
  new(
    mode: TYPE_NORMAL,
    gadget_to_procon_interval: DEFAULT_GADGET_TO_PROCON_INTERVAL,
  )
end

Instance Method Details

#to_sObject



22
23
24
25
26
27
28
# File 'lib/procon_bypass_man/procon/value_objects/bypass_mode.rb', line 22

def to_s
  if mode == TYPE_NORMAL
    "#{mode}(#{gadget_to_procon_interval})"
  else
    mode.to_s
  end
end