Class: RKit::Decorator::Base
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- RKit::Decorator::Base
- Defined in:
- lib/r_kit/decorator/base.rb
Instance Method Summary collapse
- #===(object) ⇒ Object
- #_view_context ⇒ Object
-
#initialize(obj, view_context: nil) ⇒ Base
constructor
A new instance of Base.
- #view ⇒ Object
Constructor Details
#initialize(obj, view_context: nil) ⇒ Base
Returns a new instance of Base.
6 7 8 9 |
# File 'lib/r_kit/decorator/base.rb', line 6 def initialize obj, view_context: nil @_view_context = view_context super obj end |
Instance Method Details
#===(object) ⇒ Object
21 22 23 |
# File 'lib/r_kit/decorator/base.rb', line 21 def === object self == object || __getobj__ == object end |
#_view_context ⇒ Object
12 13 14 |
# File 'lib/r_kit/decorator/base.rb', line 12 def _view_context backtrace{ |obj| obj.is_a? ActionView::Base } || backtrace{ |obj| obj.respond_to? :view_context }.view_context end |
#view ⇒ Object
16 17 18 |
# File 'lib/r_kit/decorator/base.rb', line 16 def view @_view_context ||= _view_context end |