Class: Pennylane::Object
- Inherits:
-
Object
show all
- Includes:
- Enumerable
- Defined in:
- lib/pennylane/object.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Instance Attribute Details
Returns the value of attribute id.
4
5
6
|
# File 'lib/pennylane/object.rb', line 4
def id
@id
end
|
Class Method Details
.build_from(response, params = {}, opts = {}) ⇒ Object
18
19
20
|
# File 'lib/pennylane/object.rb', line 18
def self.build_from(response, params = {}, opts = {})
new.initialize_from_response(response, params, opts)
end
|
.descendants ⇒ Object
30
31
32
|
# File 'lib/pennylane/object.rb', line 30
def self.descendants
ObjectSpace.each_object(Class).select { |klass| klass < self && respond_to?(:object_name) }
end
|
22
23
24
25
26
27
28
|
# File 'lib/pennylane/object.rb', line 22
def self.objects
{}.tap do |h|
descendants.each do |klass|
h[klass.object_name] = klass
end
end
end
|
.protected_fields ⇒ Object
14
15
16
|
# File 'lib/pennylane/object.rb', line 14
def self.protected_fields
[]
end
|
Instance Method Details
#initialize_from_response(response, params = {}, opts = {}) ⇒ Object
6
7
8
9
10
11
12
|
# File 'lib/pennylane/object.rb', line 6
def initialize_from_response(response, params = {}, opts = {})
values = Util.symbolize_names(response)
@values = self.class.send :deep_copy, values
add_accessors(@values.keys, @values)
@opts = opts
self
end
|