Class: DelegatePresenter::Base

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/delegate_presenter.rb

Instance Method Summary collapse

Constructor Details

#initialize(object_to_delegate_to) ⇒ Base

Returns a new instance of Base.



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

def initialize( object_to_delegate_to )
  super(object_to_delegate_to)
end

Instance Method Details

#h(str) ⇒ Object



32
33
34
# File 'lib/delegate_presenter.rb', line 32

def h(str)
  helpers.send(:h, str)
end

#helpersObject



20
21
22
# File 'lib/delegate_presenter.rb', line 20

def helpers
  ::ApplicationController.all_helpers  # the GLOBAL ApplicationController, not the ApplicationController in this namespace
end

#record_idObject



15
16
17
# File 'lib/delegate_presenter.rb', line 15

def record_id
  self.__getobj__.id
end

#s(*args) ⇒ Object



24
25
26
27
28
29
30
# File 'lib/delegate_presenter.rb', line 24

def s(*args)
  output = "".html_safe
  args.each {|current_arg|
    output << current_arg.html_safe
  }
  output
end