Class: Rafflesia::MoleculeSearchData
- Inherits:
-
Types::BaseModel
- Object
- Types::BaseModel
- Rafflesia::MoleculeSearchData
- 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
-
#backend ⇒ Object
Returns the value of attribute backend.
-
#db ⇒ Object
Returns the value of attribute db.
-
#hits ⇒ Object
Returns the value of attribute hits.
-
#query ⇒ Object
Returns the value of attribute query.
-
#total_matched ⇒ Object
Returns the value of attribute total_matched.
Instance Method Summary collapse
-
#initialize(json) ⇒ MoleculeSearchData
constructor
A new instance of MoleculeSearchData.
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
#backend ⇒ Object
Returns the value of attribute backend.
16 17 18 |
# File 'lib/rafflesia/molecules/molecule_search_data.rb', line 16 def backend @backend end |
#db ⇒ Object
Returns the value of attribute db.
16 17 18 |
# File 'lib/rafflesia/molecules/molecule_search_data.rb', line 16 def db @db end |
#hits ⇒ Object
Returns the value of attribute hits.
16 17 18 |
# File 'lib/rafflesia/molecules/molecule_search_data.rb', line 16 def hits @hits end |
#query ⇒ Object
Returns the value of attribute query.
16 17 18 |
# File 'lib/rafflesia/molecules/molecule_search_data.rb', line 16 def query @query end |
#total_matched ⇒ Object
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 |