Sha256: df3daff729a3aaa97cfa114eb1cfac621fe1253fd4be5cee7166f91d9a4dd3cf

Contents?: true

Size: 661 Bytes

Versions: 5

Compression:

Stored size: 661 Bytes

Contents

module ActiveAdmin

  # A simple object that gets used to present different aspects of views
  #
  # Initialize with a set of options and a block. The options become
  # available using hash style syntax.
  #
  # Usage:
  #
  #     presenter = PagePresenter.new as: :table do
  #       # some awesome stuff
  #     end
  #
  #     presenter[:as]    #=> :table
  #     presenter.block   #=> The block passed in to new
  #
  class PagePresenter

    attr_reader :block, :options

    delegate :has_key?, to: :options

    def initialize(options = {}, &block)
      @options, @block = options, block
    end

    def [](key)
      @options[key]
    end

  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
active_administration-0.0.3 lib/active_admin/page_presenter.rb
activeadministration-0.0.2 lib/active_admin/page_presenter.rb
active_administration-0.0.2 lib/active_admin/page_presenter.rb
activeadministration-0.0.1 lib/active_admin/page_presenter.rb
active_administration-0.0.1 lib/active_admin/page_presenter.rb