Class: Madmin::MemberAction

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#blockObject (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

Returns:

  • (Boolean)


13
# File 'lib/madmin/member_action.rb', line 13

def collection? = @collection

#to_procObject



17
# File 'lib/madmin/member_action.rb', line 17

def to_proc = block