Class: Volt::Persistors::Page

Inherits:
Base show all
Defined in:
lib/volt/models/persistors/page.rb

Instance Method Summary collapse

Methods inherited from Base

#added, #async?, #changed, #clear, #event_added, #event_removed, #initialize, #loaded, #removed, #root_model

Constructor Details

This class inherits a constructor from Volt::Persistors::Base

Instance Method Details

#auto_generate_idObject



6
7
8
# File 'lib/volt/models/persistors/page.rb', line 6

def auto_generate_id
  true
end

#where(query) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/volt/models/persistors/page.rb', line 10

def where(query)
  @model.select do |model|
    # Run through each key in the query and make sure the value matches.
    # We use .all? because once one fails to match, we can return false,
    # because it wouldn't match as a whole.
    query.all? do |key, value|
      model.get(key) == value
    end
  end
end