Class: Moneta::YAML

Inherits:
Object
  • Object
show all
Includes:
Defaults, Expires, Implementation
Defined in:
lib/moneta/yaml.rb

Defined Under Namespace

Modules: Implementation Classes: Expiration

Instance Method Summary collapse

Methods included from Expires

#[], #check_expired, #delete, #fetch, #key?, #store, #update_key

Methods included from Defaults

#fetch, #store

Methods included from Implementation

#[], #[]=, #clear, #delete, #key?

Constructor Details

#initialize(options = {}) ⇒ YAML

Returns a new instance of YAML.



41
42
43
44
45
46
47
48
# File 'lib/moneta/yaml.rb', line 41

def initialize(options = {})
  @file = File.expand_path(options[:path])
  unless ::File.exists?(@file)
    File.open(@file, "w") { |file| file << {}.to_yaml }
  end
 
  @expiration = Expiration.new(@file)
end