Class: Madmin::MemberAction
- Inherits:
-
Object
- Object
- Madmin::MemberAction
- Defined in:
- lib/madmin/member_action.rb
Overview
Wraps a member action block along with its options so views can decide
where to render it. Responds to to_proc and call so it can be used
anywhere the raw block was.
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
Instance Method Summary collapse
- #call(*args, &blk) ⇒ Object
- #collection? ⇒ Boolean
-
#initialize(collection: false, &block) ⇒ MemberAction
constructor
A new instance of MemberAction.
- #to_proc ⇒ Object
Constructor Details
#initialize(collection: false, &block) ⇒ MemberAction
Returns a new instance of MemberAction.
8 9 10 11 |
# File 'lib/madmin/member_action.rb', line 8 def initialize(collection: false, &block) @collection = collection @block = block end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
6 7 8 |
# File 'lib/madmin/member_action.rb', line 6 def block @block end |
Instance Method Details
#call(*args, &blk) ⇒ Object
15 |
# File 'lib/madmin/member_action.rb', line 15 def call(*args, &blk) = block.call(*args, &blk) |
#collection? ⇒ Boolean
13 |
# File 'lib/madmin/member_action.rb', line 13 def collection? = @collection |
#to_proc ⇒ Object
17 |
# File 'lib/madmin/member_action.rb', line 17 def to_proc = block |