Class: RobotLab::CompactionHookContext

Inherits:
HookContext show all
Defined in:
lib/robot_lab/hook_context.rb

Instance Attribute Summary collapse

Attributes inherited from HookContext

#event, #metadata

Instance Method Summary collapse

Methods inherited from HookContext

#ext, #local, #to_h, #with_namespace

Constructor Details

#initialize(robot:, messages_before:, config:, strategy:) ⇒ CompactionHookContext

Returns a new instance of CompactionHookContext.



137
138
139
140
141
142
143
144
# File 'lib/robot_lab/hook_context.rb', line 137

def initialize(robot:, messages_before:, config:, strategy:, **)
  super(event: :compaction, **)
  @robot            = robot
  @messages_before  = messages_before.freeze
  @config           = config
  @strategy         = strategy
  @compacted_messages = nil
end

Instance Attribute Details

#compacted_messagesObject

Returns the value of attribute compacted_messages.



135
136
137
# File 'lib/robot_lab/hook_context.rb', line 135

def compacted_messages
  @compacted_messages
end

#configObject (readonly)

Returns the value of attribute config.



134
135
136
# File 'lib/robot_lab/hook_context.rb', line 134

def config
  @config
end

#errorObject

Returns the value of attribute error.



135
136
137
# File 'lib/robot_lab/hook_context.rb', line 135

def error
  @error
end

#messages_beforeObject (readonly)

Returns the value of attribute messages_before.



134
135
136
# File 'lib/robot_lab/hook_context.rb', line 134

def messages_before
  @messages_before
end

#robotObject (readonly)

Returns the value of attribute robot.



134
135
136
# File 'lib/robot_lab/hook_context.rb', line 134

def robot
  @robot
end

#strategyObject (readonly)

Returns the value of attribute strategy.



134
135
136
# File 'lib/robot_lab/hook_context.rb', line 134

def strategy
  @strategy
end

Instance Method Details

#handled?Boolean

True once an on_compaction handler has supplied a replacement message set.

Returns:

  • (Boolean)


147
148
149
# File 'lib/robot_lab/hook_context.rb', line 147

def handled?
  !@compacted_messages.nil?
end