class FuseFS::PathMapperFS::MNode::XAttr

Merge extended attributes with the ones from the underlying file

Attributes

file_xattr[R]
node[R]

Public Class Methods

new(node) click to toggle source
# File lib/fusefs/pathmapper.rb, line 24
def initialize(node)
    @node = node
    @file_xattr = ::Xattr.new(node.real_path.to_s) if node.file? && HAS_FFI_XATTR
end

Public Instance Methods

[](key) click to toggle source
# File lib/fusefs/pathmapper.rb, line 29
def [](key)
    additional[key] || (file_xattr && file_xattr[key])
end
[]=(key,value) click to toggle source
# File lib/fusefs/pathmapper.rb, line 33
def []=(key,value)
    raise Errno::EACCES if additional.has_key?(key) || node.directory?
    file_xattr[key] = value if file_xattr
end
additional() click to toggle source
# File lib/fusefs/pathmapper.rb, line 52
def additional
    @node[:xattr] || {}
end
delete(key) click to toggle source
# File lib/fusefs/pathmapper.rb, line 38
def delete(key)
    raise Errno::EACCES if additional.has_key?(key) || node.directory?
    file_xattr.remove(key) if file_xattr
end
keys() click to toggle source
# File lib/fusefs/pathmapper.rb, line 43
def keys
    if file_xattr
        additional.keys + file_xattr.list
    else
        additional.keys
    end
end