Class: Percolate::Adapter::FixtureAdapter
- Inherits:
-
BaseAdapter
- Object
- BaseAdapter
- Percolate::Adapter::FixtureAdapter
- Defined in:
- lib/percolate/adapter/fixture_adapter.rb
Overview
An adapter for exposing a fixed attribute ‘Hash`.
Instance Method Summary collapse
-
#initialize(data_source) ⇒ FixtureAdapter
constructor
A new instance of FixtureAdapter.
- #load_entities ⇒ Object
- #load_facet(context, name) ⇒ Object
Methods inherited from BaseAdapter
#configure_facet, #create_facet, #method_missing
Constructor Details
#initialize(data_source) ⇒ FixtureAdapter
Returns a new instance of FixtureAdapter.
23 24 25 |
# File 'lib/percolate/adapter/fixture_adapter.rb', line 23 def initialize(data_source) super end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Percolate::Adapter::BaseAdapter
Instance Method Details
#load_entities ⇒ Object
27 28 29 |
# File 'lib/percolate/adapter/fixture_adapter.rb', line 27 def load_entities @data_source["entities"] end |
#load_facet(context, name) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/percolate/adapter/fixture_adapter.rb', line 31 def load_facet(context, name) name = name.to_s facets_hash = @data_source["contexts"][context]["facets"] if facets_hash.include?(name) facet_hash = facets_hash[name] facet_type = facet_hash.fetch("type", name) facet_attrs = facet_hash.fetch("attrs", {}) configure_facet(create_facet(facet_type), facet_attrs) else nil end end |