Module: Fc2
- Defined in:
- lib/fc2.rb,
lib/fc2/version.rb
Defined Under Namespace
Modules: ClassMethods
Constant Summary collapse
- VERSION =
"0.2.0"
Class Method Summary collapse
Class Method Details
.all_clear ⇒ Object
30 31 32 |
# File 'lib/fc2.rb', line 30 def self.all_clear FileUtils.rm_r(cache_dir, secure: true) if File.exist? cache_dir end |
.fetch(key: caller.first, expires_in: 300) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/fc2.rb', line 23 def self.fetch(key: caller.first, expires_in: 300) key = Digest::MD5.hexdigest(key) path = File.(key, cache_dir) return Marshal.load(File.read(path)) if use_cache?(path, expires_in) dump(path, yield) end |
.included(base) ⇒ Object
7 8 9 |
# File 'lib/fc2.rb', line 7 def self.included(base) base.extend(ClassMethods) end |