Class: Vfs::EntryProxy

Inherits:
BasicObject
Defined in:
lib/vfs/entry_proxy.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(entry) ⇒ EntryProxy

Returns a new instance of EntryProxy.



6
7
8
9
# File 'lib/vfs/entry_proxy.rb', line 6

def initialize entry
  raise 'something wrong happening here!' if entry.respond_to?(:proxy?) and entry.proxy?
  self._target = entry
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *a, &b) ⇒ Object (protected)



26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/vfs/entry_proxy.rb', line 26

def method_missing m, *a, &b
  unless _target.respond_to? m
    if ::Vfs::UniversalEntry.method_defined? m
      self.target = _target.entry
    elsif ::Vfs::Dir.method_defined? m
      self._target = _target.dir
    elsif ::Vfs::File.method_defined? m
      self._target = _target.file
    end
  end

  _target.send m, *a, &b
end

Instance Attribute Details

#_targetObject

Returns the value of attribute _target.



4
5
6
# File 'lib/vfs/entry_proxy.rb', line 4

def _target
  @_target
end

Instance Method Details

#proxy?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/vfs/entry_proxy.rb', line 11

def proxy?
  true
end