Class: Rafflesia::MoleculeInspectData

Inherits:
Types::BaseModel
  • Object
show all
Defined in:
lib/rafflesia/molecules/molecule_inspect_data.rb

Constant Summary collapse

HASH_ATTRS =
{
  atom_count: :atom_count,
  bond_count: :bond_count,
  format: :format,
  molecule_id: :molecule_id,
  objects: :objects,
  record_count: :record_count
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ MoleculeInspectData

Returns a new instance of MoleculeInspectData.



25
26
27
28
29
30
31
32
33
34
# File 'lib/rafflesia/molecules/molecule_inspect_data.rb', line 25

def initialize(json)
  super()
  hash = self.class.normalize(json)
  @atom_count = hash[:atom_count]
  @bond_count = hash[:bond_count]
  @format = hash[:format]
  @molecule_id = hash[:molecule_id]
  @objects = (hash[:objects] || []).map { |item| item ? Rafflesia::ObjectRef.new(item) : nil }
  @record_count = hash[:record_count]
end

Instance Attribute Details

#atom_countObject

Returns the value of attribute atom_count.



17
18
19
# File 'lib/rafflesia/molecules/molecule_inspect_data.rb', line 17

def atom_count
  @atom_count
end

#bond_countObject

Returns the value of attribute bond_count.



17
18
19
# File 'lib/rafflesia/molecules/molecule_inspect_data.rb', line 17

def bond_count
  @bond_count
end

#formatObject

Returns the value of attribute format.



17
18
19
# File 'lib/rafflesia/molecules/molecule_inspect_data.rb', line 17

def format
  @format
end

#molecule_idObject

Returns the value of attribute molecule_id.



17
18
19
# File 'lib/rafflesia/molecules/molecule_inspect_data.rb', line 17

def molecule_id
  @molecule_id
end

#objectsObject

Returns the value of attribute objects.



17
18
19
# File 'lib/rafflesia/molecules/molecule_inspect_data.rb', line 17

def objects
  @objects
end

#record_countObject

Returns the value of attribute record_count.



17
18
19
# File 'lib/rafflesia/molecules/molecule_inspect_data.rb', line 17

def record_count
  @record_count
end