Class: Python::Pickle::Instruction

Inherits:
Object
  • Object
show all
Defined in:
lib/python/pickle/instruction.rb

Direct Known Subclasses

Python::Pickle::Instructions::AddItems, Python::Pickle::Instructions::Append, Python::Pickle::Instructions::Appends, Python::Pickle::Instructions::BinBytes, Python::Pickle::Instructions::BinBytes8, Python::Pickle::Instructions::BinFloat, Python::Pickle::Instructions::BinGet, Python::Pickle::Instructions::BinInt1, Python::Pickle::Instructions::BinPersID, Python::Pickle::Instructions::BinPut, Python::Pickle::Instructions::BinString, Python::Pickle::Instructions::BinUnicode, Python::Pickle::Instructions::BinUnicode8, Python::Pickle::Instructions::Build, Python::Pickle::Instructions::ByteArray8, Python::Pickle::Instructions::Dict, Python::Pickle::Instructions::Dup, Python::Pickle::Instructions::EmptyDict, Python::Pickle::Instructions::EmptyList, Python::Pickle::Instructions::EmptySet, Python::Pickle::Instructions::EmptyTuple, Python::Pickle::Instructions::Ext1, Python::Pickle::Instructions::Ext2, Python::Pickle::Instructions::Ext4, Python::Pickle::Instructions::Float, Python::Pickle::Instructions::Frame, Python::Pickle::Instructions::FrozenSet, Python::Pickle::Instructions::Get, Python::Pickle::Instructions::Global, Python::Pickle::Instructions::Inst, Python::Pickle::Instructions::Int, Python::Pickle::Instructions::List, Python::Pickle::Instructions::Long, Python::Pickle::Instructions::Long1, Python::Pickle::Instructions::Long4, Python::Pickle::Instructions::LongBinGet, Python::Pickle::Instructions::Mark, Python::Pickle::Instructions::Memoize, Python::Pickle::Instructions::NewFalse, Python::Pickle::Instructions::NewObj, Python::Pickle::Instructions::NewObjEx, Python::Pickle::Instructions::NewTrue, Python::Pickle::Instructions::NextBuffer, Python::Pickle::Instructions::None, Python::Pickle::Instructions::Obj, Python::Pickle::Instructions::PersID, Python::Pickle::Instructions::Pop, Python::Pickle::Instructions::PopMark, Python::Pickle::Instructions::Proto, Python::Pickle::Instructions::Put, Python::Pickle::Instructions::ReadonlyBuffer, Python::Pickle::Instructions::Reduce, Python::Pickle::Instructions::SetItem, Python::Pickle::Instructions::SetItems, Python::Pickle::Instructions::ShortBinBytes, Python::Pickle::Instructions::ShortBinString, Python::Pickle::Instructions::ShortBinUnicode, Python::Pickle::Instructions::StackGlobal, Python::Pickle::Instructions::Stop, Python::Pickle::Instructions::String, Python::Pickle::Instructions::Tuple, Python::Pickle::Instructions::Tuple1, Python::Pickle::Instructions::Tuple2, Python::Pickle::Instructions::Tuple3

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opcode) ⇒ Instruction

Initializes the instruction.

Parameters:

  • opcode (Symbol)


15
16
17
# File 'lib/python/pickle/instruction.rb', line 15

def initialize(opcode)
  @opcode = opcode
end

Instance Attribute Details

#opcodeSymbol (readonly)

The opcode name.

Returns:

  • (Symbol)


8
9
10
# File 'lib/python/pickle/instruction.rb', line 8

def opcode
  @opcode
end

Instance Method Details

#==(other) ⇒ Boolean

Compares the instruction to another instruction.

Parameters:

  • other (Instruction)

    The other instruction to compare against.

Returns:

  • (Boolean)

    Indicates whether the other instruction matches this one.



28
29
30
# File 'lib/python/pickle/instruction.rb', line 28

def ==(other)
  (self.class == other.class) && (@opcode == other.opcode)
end

#inspectString

Inspects the instruction.

Returns:

  • (String)


46
47
48
# File 'lib/python/pickle/instruction.rb', line 46

def inspect
  "#<#{self.class}: #{self}>"
end

#to_sString

Converts the instruction into a String.

Returns:

  • (String)


37
38
39
# File 'lib/python/pickle/instruction.rb', line 37

def to_s
  @opcode.to_s
end