Class: Rafflesia::MoleculeSearchData

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

Constant Summary collapse

HASH_ATTRS =
{
  backend: :backend,
  db: :db,
  hits: :hits,
  query: :query,
  total_matched: :total_matched
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ MoleculeSearchData

Returns a new instance of MoleculeSearchData.



23
24
25
26
27
28
29
30
31
# File 'lib/rafflesia/molecules/molecule_search_data.rb', line 23

def initialize(json)
  super()
  hash = self.class.normalize(json)
  @backend = hash[:backend]
  @db = hash[:db]
  @hits = (hash[:hits] || []).map { |item| item ? Rafflesia::MoleculeSearchHit.new(item) : nil }
  @query = hash[:query]
  @total_matched = hash[:total_matched]
end

Instance Attribute Details

#backendObject

Returns the value of attribute backend.



16
17
18
# File 'lib/rafflesia/molecules/molecule_search_data.rb', line 16

def backend
  @backend
end

#dbObject

Returns the value of attribute db.



16
17
18
# File 'lib/rafflesia/molecules/molecule_search_data.rb', line 16

def db
  @db
end

#hitsObject

Returns the value of attribute hits.



16
17
18
# File 'lib/rafflesia/molecules/molecule_search_data.rb', line 16

def hits
  @hits
end

#queryObject

Returns the value of attribute query.



16
17
18
# File 'lib/rafflesia/molecules/molecule_search_data.rb', line 16

def query
  @query
end

#total_matchedObject

Returns the value of attribute total_matched.



16
17
18
# File 'lib/rafflesia/molecules/molecule_search_data.rb', line 16

def total_matched
  @total_matched
end