Module: SinderellaClone

Defined in:
lib/sinderella_clone.rb,
lib/sinderella_clone/version.rb

Constant Summary collapse

VERSION =
'0.0.1'

Class Method Summary collapse

Class Method Details

.get(id) ⇒ Object



22
23
24
# File 'lib/sinderella_clone.rb', line 22

def self.get(id)
  DataStore.instance.get(id)[:transformed]
end

.midnight(id) ⇒ Object



26
27
28
# File 'lib/sinderella_clone.rb', line 26

def self.midnight(id)
  reset_data_at id
end

.transforms(data, till_midnight = 60) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/sinderella_clone.rb', line 6

def self.transforms(data, till_midnight = 60)
  identifier  = Crimp.signature data
  cloned_data = deep_copy data
  transformed = yield cloned_data

  store(
    id:           identifier,
    original:     data,
    transformed:  transformed
  )

  check(identifier, till_midnight)

  identifier
end