Class: Voom::Presenters::DSL::Components::ToggleBase

Inherits:
Input show all
Defined in:
lib/voom/presenters/dsl/components/toggle_base.rb

Overview

Base class used by toggle classes

Direct Known Subclasses

Checkbox, IconToggle, RadioButton, Switch

Instance Attribute Summary collapse

Attributes inherited from Input

#dirtyable, #disabled, #name

Attributes inherited from EventBase

#event_parent_id

Attributes included from Mixins::Event

#events

Attributes inherited from Base

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

Instance Method Summary collapse

Methods inherited from Input

#validation_error

Methods included from Mixins::Tooltips

#tooltip

Methods included from Mixins::Event

#event

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) ⇒ ToggleBase

Returns a new instance of ToggleBase.



13
14
15
16
17
18
19
20
# File 'lib/voom/presenters/dsl/components/toggle_base.rb', line 13

def initialize(**attribs_, &block)
  super(**attribs_, &block)
  @text = attribs.delete(:text)
  @text_color = attribs.delete(:text_color)
  @checked = attribs.delete(:checked) { false }
  @value = attribs.delete(:value)
  @off_value = attribs.delete(:off_value)
end

Instance Attribute Details

#checkedObject

Returns the value of attribute checked.



7
8
9
# File 'lib/voom/presenters/dsl/components/toggle_base.rb', line 7

def checked
  @checked
end

#off_valueObject

Returns the value of attribute off_value.



7
8
9
# File 'lib/voom/presenters/dsl/components/toggle_base.rb', line 7

def off_value
  @off_value
end

#textObject

Returns the value of attribute text.



7
8
9
# File 'lib/voom/presenters/dsl/components/toggle_base.rb', line 7

def text
  @text
end

#text_colorObject

Returns the value of attribute text_color.



7
8
9
# File 'lib/voom/presenters/dsl/components/toggle_base.rb', line 7

def text_color
  @text_color
end

#valueObject

Returns the value of attribute value.



7
8
9
# File 'lib/voom/presenters/dsl/components/toggle_base.rb', line 7

def value
  @value
end