Module: Python::Pickle::Instructions::HasValue
- Included in:
- BinFloat, BinGet, BinInt1, BinPut, Ext1, Ext2, Ext4, Float, Frame, Get, Int, Long, LongBinGet, PersID, Proto, Put, String
- Defined in:
- lib/python/pickle/instructions/has_value.rb
Overview
A mixin which adds a value to an instruction class.
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
The value associated with the instruction.
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
Compares the instruction to another instruction.
-
#initialize(opcode, value) ⇒ Object
Initializes the instruction.
-
#to_s ⇒ String
Converts the instruction to a String.
Instance Attribute Details
#value ⇒ Object (readonly)
The value associated with the instruction.
11 12 13 |
# File 'lib/python/pickle/instructions/has_value.rb', line 11 def value @value end |
Instance Method Details
#==(other) ⇒ Boolean
Compares the instruction to another instruction.
35 36 37 |
# File 'lib/python/pickle/instructions/has_value.rb', line 35 def ==(other) super(other) && other.kind_of?(HasValue) && (@value == other.value) end |
#initialize(opcode, value) ⇒ Object
Initializes the instruction.
20 21 22 23 24 |
# File 'lib/python/pickle/instructions/has_value.rb', line 20 def initialize(opcode,value) super(opcode) @value = value end |
#to_s ⇒ String
Converts the instruction to a String.
44 45 46 |
# File 'lib/python/pickle/instructions/has_value.rb', line 44 def to_s "#{super} #{@value.inspect}" end |