Class: Percolate::Facet::FixtureFacet
- Defined in:
- lib/percolate/facet/fixture_facet.rb
Overview
A facet for looking up entities based on a fixed attribute ‘Hash`.
Instance Attribute Summary collapse
-
#fixtures ⇒ Hash
Gets the fixtures.
Instance Method Summary collapse
- #find(key) ⇒ Object
-
#initialize ⇒ FixtureFacet
constructor
A new instance of FixtureFacet.
- #merge(other) ⇒ Object
Constructor Details
#initialize ⇒ FixtureFacet
Returns a new instance of FixtureFacet.
25 26 27 |
# File 'lib/percolate/facet/fixture_facet.rb', line 25 def initialize @fixtures = {} end |
Instance Attribute Details
#fixtures ⇒ Hash
Gets the fixtures.
32 33 34 |
# File 'lib/percolate/facet/fixture_facet.rb', line 32 def fixtures @fixtures end |
Instance Method Details
#find(key) ⇒ Object
36 37 38 |
# File 'lib/percolate/facet/fixture_facet.rb', line 36 def find(key) @fixtures[key] end |
#merge(other) ⇒ Object
40 41 42 43 44 45 46 47 |
# File 'lib/percolate/facet/fixture_facet.rb', line 40 def merge(other) raise ArgumentError, "Please provide another #{self.class}" if !other.is_a?(FixtureFacet) merged = FixtureFacet.new merged.fixtures = @fixtures.merge(other.fixtures) merged end |