Module: Hanami::View::Escape::Presentable

Included in:
Presenter
Defined in:
lib/hanami/view/escape.rb

Overview

Since:

  • 0.4.0

Class Method Summary collapse

Instance Method Summary collapse

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

Since:

  • 0.7.0



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.

See Also:

Since:

  • 0.7.0



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

Parameters:

  • object (Object)

    the object to present

Since:

  • 0.7.0



136
137
138
# File 'lib/hanami/view/escape.rb', line 136

def initialize(object)
  @object = object
end