Class: Showcase::Presenter

Inherits:
SimpleDelegator
  • Object
show all
Extended by:
Helpers::ModuleMethodBuilder
Includes:
Helpers::Present
Defined in:
lib/showcase/presenter.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Helpers::ModuleMethodBuilder

define_module_method

Methods included from Helpers::Present

#present, #present_collection, #presenter_context

Constructor Details

#initialize(obj, context) ⇒ Presenter

Returns a new instance of Presenter.


19
20
21
22
# File 'lib/showcase/presenter.rb', line 19

def initialize(obj, context)
  super(obj)
  @view_context = context
end

Instance Attribute Details

#view_contextObject (readonly) Also known as: h

Returns the value of attribute view_context.


12
13
14
# File 'lib/showcase/presenter.rb', line 12

def view_context
  @view_context
end

Class Method Details

.presents(*args) ⇒ Object


37
38
39
# File 'lib/showcase/presenter.rb', line 37

def self.presents(*args)
  wrap_methods(args, :present)
end

.presents_collection(*args) ⇒ Object


41
42
43
# File 'lib/showcase/presenter.rb', line 41

def self.presents_collection(*args)
  wrap_methods(args, :present_collection)
end

Instance Method Details

#__decorator_class__Object


17
# File 'lib/showcase/presenter.rb', line 17

alias_method :__decorator_class__, :class

#classObject


24
25
26
# File 'lib/showcase/presenter.rb', line 24

def class
  object.class
end

#instance_of?(klass) ⇒ Boolean

Returns:

  • (Boolean)

33
34
35
# File 'lib/showcase/presenter.rb', line 33

def instance_of?(klass)
  object.instance_of?(klass)
end

#kind_of?(klass) ⇒ Boolean Also known as: is_a?

Returns:

  • (Boolean)

28
29
30
# File 'lib/showcase/presenter.rb', line 28

def kind_of?(klass)
  object.kind_of?(klass)
end