Class: GraphAgent::Interrupt

Inherits:
Object
  • Object
show all
Defined in:
lib/graph_agent/types/interrupt.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value, id: nil) ⇒ Interrupt

Returns a new instance of Interrupt.



9
10
11
12
# File 'lib/graph_agent/types/interrupt.rb', line 9

def initialize(value, id: nil)
  @value = value
  @id = id || SecureRandom.hex(16)
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



7
8
9
# File 'lib/graph_agent/types/interrupt.rb', line 7

def id
  @id
end

#valueObject (readonly)

Returns the value of attribute value.



7
8
9
# File 'lib/graph_agent/types/interrupt.rb', line 7

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



14
15
16
# File 'lib/graph_agent/types/interrupt.rb', line 14

def ==(other)
  other.is_a?(Interrupt) && id == other.id && value == other.value
end

#hashObject



19
20
21
# File 'lib/graph_agent/types/interrupt.rb', line 19

def hash
  [id, value].hash
end

#to_sObject Also known as: inspect



23
24
25
# File 'lib/graph_agent/types/interrupt.rb', line 23

def to_s
  "Interrupt(value=#{value.inspect}, id=#{id.inspect})"
end