Class: Voom::Presenters::DSL::Components::Card::Actions

Inherits:
Base
  • Object
show all
Defined in:
lib/voom/presenters/dsl/components/card.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#attributes, #context, #id, #type

Instance Method Summary collapse

Methods inherited from Base

#expand!

Methods included from Mixins::YieldTo

#yield_to

Methods included from Serializer

#to_hash

Methods included from Lockable

#lock!, #locked?

Constructor Details

#initialize(**attribs_, &block) ⇒ Actions

Returns a new instance of Actions.



105
106
107
108
109
# File 'lib/voom/presenters/dsl/components/card.rb', line 105

def initialize(**attribs_, &block)
  super(type: :action, **attribs_, &block)
  @buttons = []
  expand!
end

Instance Attribute Details

#buttonsObject

Returns the value of attribute buttons.



103
104
105
# File 'lib/voom/presenters/dsl/components/card.rb', line 103

def buttons
  @buttons
end

Instance Method Details

#button(text = nil, **options, &block) ⇒ Object



111
112
113
114
115
# File 'lib/voom/presenters/dsl/components/card.rb', line 111

def button(text=nil, **options, &block)
  @buttons << Components::Button.new(parent: self, text: text,
                                     context: context,
                                     **options, &block)
end