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.


8
9
10
11
# File 'lib/vfs/entry_proxy.rb', line 8

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)


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

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


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

def _target
  @_target
end

Instance Method Details

#proxy?Boolean

Returns:

  • (Boolean)

13
14
15
# File 'lib/vfs/entry_proxy.rb', line 13

def proxy?
  true
end