Sha256: 7ad77184c275f311b45834d30796e21edb481cbce60059cc3421a208ce421baf

Contents?: true

Size: 677 Bytes

Versions: 2

Compression:

Stored size: 677 Bytes

Contents

module SimplePresenter
  class Railtie < Rails::Railtie
    config.simple_presenter = ActiveSupport::OrderedOptions.new
  end

  class Base
    delegate :translate, :t, :localize, :l, :to => :helpers
    private :translate, :t, :localize, :l

    private
    def self.routes_module
      @routes_module ||= Module.new do
        include Rails.application.routes.url_helpers
        include UrlMethods
      end
    end

    def self.routes
      @routes ||= Object.new.extend(routes_module)
    end

    def routes
      self.class.routes
    end
    alias_method :r, :routes

    def helpers
      ApplicationController.helpers
    end
    alias_method :h, :helpers
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
simple_presenter-0.2.2 lib/simple_presenter/rails.rb
simple_presenter-0.2.1 lib/simple_presenter/rails.rb