Class: Voom::Presenters::DSL::Components::Link

Inherits:
Typography show all
Defined in:
lib/voom/presenters/dsl/components/link.rb

Constant Summary collapse

VALID_TARGETS =
%i[self blank].freeze

Instance Attribute Summary collapse

Attributes inherited from Typography

#color, #inline, #level, #markdown, #position

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 Typography

#icon

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

Returns a new instance of Link.



10
11
12
13
14
15
16
17
18
# File 'lib/voom/presenters/dsl/components/link.rb', line 10

def initialize(parent:, **attribs_, &block)
  super(type: :link, parent: parent, **attribs_, &block)

  @url = attribs_.delete(:url)
  @text = attribs_.delete(:text) { url }
  @target = validate_target(attribs_.delete(:target) { :self })

  expand!
end

Instance Attribute Details

#targetObject

Returns the value of attribute target.



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

def target
  @target
end

#textObject

Returns the value of attribute text.



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

def text
  @text
end

#urlObject

Returns the value of attribute url.



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

def url
  @url
end