Class: Pres::Presenter

Inherits:
Object
  • Object
show all
Includes:
Presents, ViewDelegation
Defined in:
lib/pres/presenter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ViewDelegation

#method_missing, #respond_to_missing?, #view_context

Constructor Details

#initialize(object, view_context = nil, options = {}) ⇒ Presenter

Returns a new instance of Presenter.



12
13
14
15
16
# File 'lib/pres/presenter.rb', line 12

def initialize(object, view_context = nil, options = {})
  @object = object
  @view_context = view_context
  @options = options
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Pres::ViewDelegation

Instance Attribute Details

#objectObject (readonly)

Returns the value of attribute object.



10
11
12
# File 'lib/pres/presenter.rb', line 10

def object
  @object
end

#optionsObject (readonly)

Returns the value of attribute options.



10
11
12
# File 'lib/pres/presenter.rb', line 10

def options
  @options
end

Instance Method Details

#idObject



18
19
20
# File 'lib/pres/presenter.rb', line 18

def id
  object.id
end

#inspectObject



26
27
28
29
30
31
32
# File 'lib/pres/presenter.rb', line 26

def inspect
  [
    object.inspect,
    "options: #{options.inspect}",
    "view_context: #{view_context.class.name}"
  ].join("\n")
end

#to_partial_pathObject



22
23
24
# File 'lib/pres/presenter.rb', line 22

def to_partial_path
  object.to_partial_path
end