Class: As
Overview
Support class for Kernel#as.
TODO: Deprecate this and use Functor (HigherOrderMessage) instead ?
Class Method Summary (collapse)
- + (Object) new(subject, ancestor) (also: _new)
Instance Method Summary (collapse)
-
- (As) initialize(subject, ancestor)
constructor
A new instance of As.
Constructor Details
- (As) initialize(subject, ancestor)
A new instance of As
105 106 107 108 |
# File 'lib/core/facets/kernel/as.rb', line 105 def initialize(subject, ancestor) @subject = subject @ancestor = ancestor end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
- (Object) method_missing(sym, *args, &blk) (private)
111 112 113 |
# File 'lib/core/facets/kernel/as.rb', line 111 def method_missing(sym, *args, &blk) @ancestor.instance_method(sym).bind(@subject).call(*args,&blk) end |
Class Method Details
+ (Object) new(subject, ancestor) Also known as: _new
90 91 92 |
# File 'lib/core/facets/kernel/as.rb', line 90 def new(subject, ancestor) cache[subject][ancestor] ||= _new(subject, ancestor) end |