Class: Quick::FS::ModuleDir

Inherits:
Object show all
Defined in:
lib/quick/fs.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(mod) ⇒ ModuleDir

Returns a new instance of ModuleDir.



152
153
154
# File 'lib/quick/fs.rb', line 152

def initialize(mod)
  @mod = mod
end

Class Method Details

.path_method(name, value = nil, &body) ⇒ Object



131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# File 'lib/quick/fs.rb', line 131

def self.path_method(name, value=nil, &body)
  body = proc {value} if value and not body
  define_method name do |path=nil, *args|
    cur, child = path_parts path
    if cur
      target = child cur
      if target.respond_to? name
        target.send name, child, *args
      else
        FuseFS::DEFAULT_FS.send name, child, *args
      end
    else
      if body
        instance_exec *args, &body
      else
        FuseFS::DEFAULT_FS.send name, child, *args
      end
    end
  end
end