Sha256: 5afc4f1209405e30a8d1cd43b38fe0edea326bb3c30f2dadc490985a540e0aa5

Contents?: true

Size: 679 Bytes

Versions: 7

Compression:

Stored size: 679 Bytes

Contents

module Pagify
  module Helper
    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
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
godfat-pagify-0.6.1 lib/pagify/helper/detail/setup.rb
godfat-pagify-0.6.2 lib/pagify/helper/detail/setup.rb
pagify-0.8.0 lib/pagify/helper/detail/setup.rb
pagify-0.7.1 lib/pagify/helper/detail/setup.rb
pagify-0.7.0 lib/pagify/helper/detail/setup.rb
pagify-0.6.2 lib/pagify/helper/detail/setup.rb
pagify-0.6.1 lib/pagify/helper/detail/setup.rb