Class: ActiveAdmin::PagePresenter
- Inherits:
-
Object
- Object
- ActiveAdmin::PagePresenter
- Defined in:
- lib/active_admin/page_presenter.rb
Overview
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
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #[](key) ⇒ Object
-
#initialize(options = {}, &block) ⇒ PagePresenter
constructor
A new instance of PagePresenter.
Constructor Details
#initialize(options = {}, &block) ⇒ PagePresenter
Returns a new instance of PagePresenter.
24 25 26 27 |
# File 'lib/active_admin/page_presenter.rb', line 24 def initialize( = {}, &block) @options = @block = block end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
20 21 22 |
# File 'lib/active_admin/page_presenter.rb', line 20 def block @block end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
20 21 22 |
# File 'lib/active_admin/page_presenter.rb', line 20 def @options end |
Instance Method Details
#[](key) ⇒ Object
29 30 31 |
# File 'lib/active_admin/page_presenter.rb', line 29 def [](key) @options[key] end |