Sha256: 3f0fbc5651b87ce347044cb2d05c46d83cdbe47aa60700ab47c80fc67e9207d9
Contents?: true
Size: 1.35 KB
Versions: 3
Compression:
Stored size: 1.35 KB
Contents
module Python module Pickle module Instructions # # A mixin which adds a length and a value to an instruction class. # module HasLengthAndValue # The length of the value associated with the instruction. # # @return [Integer] attr_reader :length # The value associated with the instruction. # # @return [Object] attr_reader :value # # Initializes the instruction. # # @param [Symbol] opcode # # @param [Object] value # def initialize(opcode,length,value) super(opcode) @value = value @length = length end # # Compares the instruction to another instruction. # # @param [Instruction] other # The other instruction to compare against. # # @return [Boolean] # Indicates whether the other instruction matches this one. # def ==(other) super(other) && other.kind_of?(HasLengthAndValue) && (@length == other.length && @value == other.value) end # # Converts the instruction to a String. # # @return [String] # def to_s "#{super} #{@length.inspect} #{@value.inspect}" end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems