Sha256: 974476c2250bc0d70369907d759881889ab7bc58d4afaf18668fa5b313856ca4

Contents?: true

Size: 523 Bytes

Versions: 2

Compression:

Stored size: 523 Bytes

Contents

require 'singleton'

class DataStore
  include Singleton

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

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

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

  def reset(id)
    original  = container.fetch(id)[:original]
    hash_data = {
      :original => original,
      :transformed => original
    }

    container.store(id, hash_data)
  end

  private

  def container
    @store ||= Hash.new
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
yakiniku-0.0.1 lib/yakiniku/data_store.rb
hoohoo-0.0.1 lib/hoohoo/data_store.rb