Module: Platanus::Layered

Defined in:
lib/platanus/layered.rb

Overview

Adds simple proxy capabilities to a class, allowing it instances to wrap other objects transparently

Instance Attribute Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(_method, *_args, &_block) ⇒ Object



17
18
19
# File 'lib/platanus/layered.rb', line 17

def method_missing(_method, *_args, &_block)
  @lo_target.send(_method, *_args, &_block)
end

Instance Attribute Details

#lo_targetObject (readonly)

Returns the value of attribute lo_target.



6
7
8
# File 'lib/platanus/layered.rb', line 6

def lo_target
  @lo_target
end

Instance Method Details

#initialize(_entity) ⇒ Object



8
9
10
# File 'lib/platanus/layered.rb', line 8

def initialize(_entity)
  @lo_target = _entity
end

#respond_to?(_what) ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
15
# File 'lib/platanus/layered.rb', line 12

def respond_to?(_what)
  return true if super(_what)
  return @lo_target.respond_to? _what
end