Class: Python::Pickle::PyClass
- Inherits:
-
Object
- Object
- Python::Pickle::PyClass
- Defined in:
- lib/python/pickle/py_class.rb
Overview
Represents a Python class.
Instance Attribute Summary collapse
-
#name ⇒ String
readonly
The name of the Python class.
-
#namespace ⇒ String
readonly
The namespace the Python class is defined within.
Instance Method Summary collapse
-
#initialize(namespace = nil, name) ⇒ PyClass
constructor
private
Initializes the Python class.
-
#inspect ⇒ String
Inspects the Python object.
-
#new(*args, **kwargs) ⇒ Object
private
Initializes a new Python object from the Python class.
-
#to_s ⇒ String
Converts the Python class into a String.
Constructor Details
#initialize(namespace = nil, name) ⇒ PyClass
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initializes the Python class.
31 32 33 34 |
# File 'lib/python/pickle/py_class.rb', line 31 def initialize(namespace=nil,name) @namespace = namespace @name = name end |
Instance Attribute Details
#name ⇒ String (readonly)
The name of the Python class.
18 19 20 |
# File 'lib/python/pickle/py_class.rb', line 18 def name @name end |
#namespace ⇒ String (readonly)
The namespace the Python class is defined within.
13 14 15 |
# File 'lib/python/pickle/py_class.rb', line 13 def namespace @namespace end |
Instance Method Details
#inspect ⇒ String
Inspects the Python object.
69 70 71 |
# File 'lib/python/pickle/py_class.rb', line 69 def inspect "#<#{self.class}: #{self}>" end |
#new(*args, **kwargs) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initializes a new Python object from the Python class.
47 48 49 |
# File 'lib/python/pickle/py_class.rb', line 47 def new(*args,**kwargs) PyObject.new(self,*args,**kwargs) end |
#to_s ⇒ String
Converts the Python class into a String.
56 57 58 59 60 61 62 |
# File 'lib/python/pickle/py_class.rb', line 56 def to_s if @namespace "#{@namespace}.#{@name}" else @name.to_s end end |