Class: Yaoc::Helper::ToProcDelegator

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/yaoc/helper/to_proc_delegator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(_initialisation_proc) ⇒ ToProcDelegator

Returns a new instance of ToProcDelegator.



6
7
8
9
10
11
# File 'lib/yaoc/helper/to_proc_delegator.rb', line 6

def initialize(_initialisation_proc)
  super(nil).tap do
    self._initialisation_proc = _initialisation_proc
    self._initialisation_proc_loaded = false
  end
end

Instance Attribute Details

#_initialisation_procObject

Returns the value of attribute _initialisation_proc.



4
5
6
# File 'lib/yaoc/helper/to_proc_delegator.rb', line 4

def _initialisation_proc
  @_initialisation_proc
end

#_initialisation_proc_loadedObject

Returns the value of attribute _initialisation_proc_loaded.



4
5
6
# File 'lib/yaoc/helper/to_proc_delegator.rb', line 4

def _initialisation_proc_loaded
  @_initialisation_proc_loaded
end

Instance Method Details

#__getobj__Object



14
15
16
17
18
19
20
21
# File 'lib/yaoc/helper/to_proc_delegator.rb', line 14

def __getobj__
  unless self._initialisation_proc_loaded
    self._initialisation_proc_loaded = true
    __setobj__(self._initialisation_proc.call())
  end

  super
end

#classObject



23
24
25
# File 'lib/yaoc/helper/to_proc_delegator.rb', line 23

def class
  __getobj__.class
end

#kind_of?(some_class) ⇒ Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/yaoc/helper/to_proc_delegator.rb', line 27

def kind_of?(some_class)
  super || __getobj__.kind_of?(some_class)
end