Class: Moneta::Xattr

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

Defined Under Namespace

Modules: Implementation

Instance Method Summary collapse

Methods included from Implementation

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

Methods included from Defaults

#fetch, #store

Constructor Details

#initialize(options = {}) ⇒ Xattr

Returns a new instance of Xattr.



13
14
15
16
17
18
19
20
21
22
# File 'lib/moneta/xattr.rb', line 13

def initialize(options = {})
  file = options[:file]
  @hash = ::Xattr.new(file)
  FileUtils.mkdir_p(::File.dirname(file))
  FileUtils.touch(file)
  unless options[:skip_expires]
    @expiration = Moneta::Xattr.new(:file => "#{file}_expiration", :skip_expires => true)
    self.extend(Expires)
  end
end