class Percolate::Adapter::FixtureAdapter
An adapter for exposing a fixed attribute `Hash`.
Public Class Methods
new(data_source)
click to toggle source
Calls superclass method
Percolate::Adapter::BaseAdapter::new
# File lib/percolate/adapter/fixture_adapter.rb, line 22 def initialize(data_source) super end
Public Instance Methods
load_entities()
click to toggle source
# File lib/percolate/adapter/fixture_adapter.rb, line 26 def load_entities @data_source["entities"] end
load_facet(context, name)
click to toggle source
# File lib/percolate/adapter/fixture_adapter.rb, line 30 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