Module: Pagify::Helper

Defined in:
lib/pagify/helper/html.rb,
lib/pagify/helper/abstract.rb,
lib/pagify/helper/detail/web.rb,
lib/pagify/helper/detail/setup.rb,
lib/pagify/helper/detail/setting.rb

Defined Under Namespace

Modules: Innate, Rails, Web Classes: Abstract, HTML, Setting

Class Method Summary collapse

Class Method Details

.setup(helper_class) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/pagify/helper/detail/setup.rb', line 4

def self.setup helper_class
  Pagify::BasicPager.module_eval do
    helper_name = helper_class.to_s.downcase[/::?(\w+)$/, 1]
    define_method helper_name do
      variable_name = "@helper_#{helper_name}"
      instance_variable_get(variable_name) or
      instance_variable_set(variable_name, helper_class.new(self))
    end
  end

  # hmm.... how should i define this method?
  # Pagify::BasicPage.module_eval do
  #   helper_name = helper_class.to_s.downcase[/::?(\w+)$/, 1]
  #   define_method helper_name do
  #     pager.__send__ helper_name
  #   end
  # end
end