Module: Hanami::View::Escape::Presentable
- Included in:
- Presenter
- Defined in:
- lib/hanami/view/escape.rb
Overview
Class Method Summary collapse
-
.included(base) ⇒ Object
private
Inject escape logic into the given class.
Instance Method Summary collapse
-
#initialize(object) ⇒ Object
Initialize the presenter.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args, &blk) ⇒ Object (protected)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Override Ruby’s method_missing
146 147 148 149 150 151 152 |
# File 'lib/hanami/view/escape.rb', line 146 def method_missing(m, *args, &blk) if @object.respond_to?(m) ::Hanami::View::Escape.html(@object.__send__(m, *args, &blk)) else super end end |
Class Method Details
.included(base) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Inject escape logic into the given class.
127 128 129 |
# File 'lib/hanami/view/escape.rb', line 127 def self.included(base) base.extend ::Hanami::View::Escape end |
Instance Method Details
#initialize(object) ⇒ Object
Initialize the presenter
136 137 138 |
# File 'lib/hanami/view/escape.rb', line 136 def initialize(object) @object = object end |