Module: Python::Pickle::Instructions::HasNamespaceAndName

Included in:
Global, Inst
Defined in:
lib/python/pickle/instructions/has_namespace_and_name.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#name ⇒ String (readonly)

The constant name.

Returns:



13
14
15
# File 'lib/python/pickle/instructions/has_namespace_and_name.rb', line 13

def name
  @name
end

#namespace ⇒ String (readonly)

The constant's namespace.

Returns:



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

def namespace
  @namespace
end

Instance Method Details

#==(other) ⇒ Boolean

Compares the instruction to another instruction.

Parameters:

  • The other instruction to compare against.

Returns:

  • Indicates whether the other instruction matches this one.



43
44
45
46
47
# File 'lib/python/pickle/instructions/has_namespace_and_name.rb', line 43

def ==(other)
  super(other) && \
    (@namespace == other.namespace) && \
    (@name == other.name)
end

#initialize(opcode, namespace, name) ⇒ Object

Initializes the instruction.

Parameters:

  • The instruction's opcode.

  • The namespace name for the constant.

  • The name of the constant.



27
28
29
30
31
32
# File 'lib/python/pickle/instructions/has_namespace_and_name.rb', line 27

def initialize(opcode,namespace,name)
  super(opcode)

  @namespace = namespace
  @name      = name
end

#to_s ⇒ String

Converts the instructions to a String.

Returns:



54
55
56
# File 'lib/python/pickle/instructions/has_namespace_and_name.rb', line 54

def to_s
  "#{super} #{@namespace}.#{@name}"
end