Class: DataStore

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/sinderella_clone/data_store.rb

Instance Method Summary collapse

Instance Method Details

#get(id) ⇒ Object



15
16
17
# File 'lib/sinderella_clone/data_store.rb', line 15

def get(id)
  container.fetch(id)
end

#reset(id) ⇒ Object



19
20
21
22
23
24
25
26
27
# File 'lib/sinderella_clone/data_store.rb', line 19

def reset(id)
  original = container.fetch(id)[:original]

  set(
    id:           id,
    original:     original,
    transformed:  original
  )
end

#set(data) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/sinderella_clone/data_store.rb', line 6

def set(data)
  hash_data = {
    original:     data[:original],
    transformed:  data[:transformed]
  }

  container.store(data[:id], hash_data)
end