Class: Voom::Presenters::DSL::Components::Typography
- Includes:
- Mixins::Tooltips
- Defined in:
- lib/voom/presenters/dsl/components/typography.rb
Instance Attribute Summary collapse
-
#color ⇒ Object
Returns the value of attribute color.
-
#inline ⇒ Object
Returns the value of attribute inline.
-
#level ⇒ Object
Returns the value of attribute level.
-
#markdown ⇒ Object
Returns the value of attribute markdown.
-
#position ⇒ Object
Returns the value of attribute position.
-
#text ⇒ Object
Returns the value of attribute text.
Attributes inherited from EventBase
Attributes included from Mixins::Event
Attributes inherited from Base
#attributes, #css_class, #draggable, #drop_zone, #id, #tag, #type
Instance Method Summary collapse
- #icon(icon = nil, **attribs, &block) ⇒ Object
-
#initialize(parent:, level: nil, **attribs_, &block) ⇒ Typography
constructor
A new instance of Typography.
Methods included from Mixins::Tooltips
Methods included from Mixins::Event
Methods inherited from Base
Methods included from Pluggable
#include_plugins, #plugin, #plugin_module
Methods included from Mixins::YieldTo
Methods included from Serializer
Methods included from Lockable
Constructor Details
#initialize(parent:, level: nil, **attribs_, &block) ⇒ Typography
Returns a new instance of Typography.
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/voom/presenters/dsl/components/typography.rb', line 10 def initialize(parent:, level: nil, **attribs_, &block) super(type: :text, parent: parent, **attribs_, &block) @text = Array(attribs.delete(:text)||'').flatten.join("\n\n").split("\n\n") @level = level @color = attribs.delete(:color) @inline = attribs.delete(:inline) { false } @position = Array(attribs.delete(:position)).compact @markdown = attribs.delete(:markdown) { true } end |
Instance Attribute Details
#color ⇒ Object
Returns the value of attribute color.
8 9 10 |
# File 'lib/voom/presenters/dsl/components/typography.rb', line 8 def color @color end |
#inline ⇒ Object
Returns the value of attribute inline.
8 9 10 |
# File 'lib/voom/presenters/dsl/components/typography.rb', line 8 def inline @inline end |
#level ⇒ Object
Returns the value of attribute level.
8 9 10 |
# File 'lib/voom/presenters/dsl/components/typography.rb', line 8 def level @level end |
#markdown ⇒ Object
Returns the value of attribute markdown.
8 9 10 |
# File 'lib/voom/presenters/dsl/components/typography.rb', line 8 def markdown @markdown end |
#position ⇒ Object
Returns the value of attribute position.
8 9 10 |
# File 'lib/voom/presenters/dsl/components/typography.rb', line 8 def position @position end |
#text ⇒ Object
Returns the value of attribute text.
8 9 10 |
# File 'lib/voom/presenters/dsl/components/typography.rb', line 8 def text @text end |
Instance Method Details
#icon(icon = nil, **attribs, &block) ⇒ Object
21 22 23 24 25 |
# File 'lib/voom/presenters/dsl/components/typography.rb', line 21 def icon(icon=nil, **attribs, &block) return @icon if locked? @icon = Components::Icon.new(parent: self, icon: icon, **attribs, &block) end |