Class: Trifle::Loader

Inherits:
Object
  • Object
show all
Includes:
InitializeWithRedis
Defined in:
lib/trifle/loader.rb

Instance Attribute Summary

Attributes included from InitializeWithRedis

#key, #redis

Instance Method Summary collapse

Methods included from InitializeWithRedis

#initialize

Instance Method Details

#clearObject



25
26
27
# File 'lib/trifle/loader.rb', line 25

def clear
  redis.del key
end

#handle(options = {}) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/trifle/loader.rb', line 9

def handle options = {}
  if options[:filename]
    load_files [options[:filename]]
  elsif options[:filenames]
    load_files options[:filenames]
  elsif options[:data]
    load_data options[:data]
  else
    raise ArgumentError.new("Please provide a :filename, :filenames or an array of :data as an argument.")
  end
end

#tmp_keyObject



21
22
23
# File 'lib/trifle/loader.rb', line 21

def tmp_key
  "#{key}:tmp"
end