Class: Voom::Presenters::DSL::Components::Typography

Inherits:
EventBase
  • Object
show all
Includes:
Mixins::Tooltips
Defined in:
lib/voom/presenters/dsl/components/typography.rb

Instance Attribute Summary collapse

Attributes inherited from EventBase

#event_parent_id

Attributes included from Mixins::Event

#events

Attributes inherited from Base

#attributes, #context, #id, #type

Instance Method Summary collapse

Methods included from Mixins::Tooltips

#tooltip

Methods included from Mixins::Event

#event

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(parent:, **attribs_, &block) ⇒ Typography

Returns a new instance of Typography.



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

def initialize(parent:, **attribs_, &block)
  super(type: :text, parent: parent, **attribs_, &block)
  @text = Array(attribs.delete(:text)||'').flatten.join("\n\n").split("\n\n")
  @level = attribs.delete(:level){1}
  @color = attribs.delete(:color)
  @position = Array(attribs.delete(:position)).compact
  expand!
end

Instance Attribute Details

#colorObject

Returns the value of attribute color.



11
12
13
# File 'lib/voom/presenters/dsl/components/typography.rb', line 11

def color
  @color
end

#levelObject

Returns the value of attribute level.



11
12
13
# File 'lib/voom/presenters/dsl/components/typography.rb', line 11

def level
  @level
end

#positionObject

Returns the value of attribute position.



11
12
13
# File 'lib/voom/presenters/dsl/components/typography.rb', line 11

def position
  @position
end

#textObject

Returns the value of attribute text.



11
12
13
# File 'lib/voom/presenters/dsl/components/typography.rb', line 11

def text
  @text
end