Class: Voom::Presenters::DSL::Components::Snackbar

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

Defined Under Namespace

Classes: Action

Instance Attribute Summary collapse

Attributes inherited from Base

#attributes, #css_class, #draggable, #drop_zone, #id, #tag, #type

Instance Method Summary collapse

Methods inherited from Base

#expand!

Methods included from Pluggable

#include_plugins, #plugin, #plugin_module

Methods included from Mixins::YieldTo

#yield_to

Methods included from Serializer

#to_hash

Methods included from Lockable

#locked?

Constructor Details

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

Returns a new instance of Snackbar.



8
9
10
11
12
# File 'lib/voom/presenters/dsl/components/snackbar.rb', line 8

def initialize(**attribs_, &block)
  super(type: :snackbar, **attribs_, &block)
  @text = attribs.delete(:text)
  expand!
end

Instance Attribute Details

#textObject

Returns the value of attribute text.



6
7
8
# File 'lib/voom/presenters/dsl/components/snackbar.rb', line 6

def text
  @text
end

Instance Method Details

#action(text = nil, &block) ⇒ Object



14
15
16
17
# File 'lib/voom/presenters/dsl/components/snackbar.rb', line 14

def action(text=nil, &block)
  return @action if locked?
  @action = Action.new(parent: self, text: text, &block)
end