Class: Voom::Presenters::DSL::Components::Tooltip

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

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

Returns a new instance of Tooltip.



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

def initialize(**attribs_, &block)
  super(type: :tooltip,
        **attribs_, &block)
  @position = attribs.delete(:position){ :left }
  self.text(attribs.delete(:text)) if attribs.key?(:text)
  expand!
end

Instance Attribute Details

#positionObject (readonly)

Returns the value of attribute position.



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

def position
  @position
end

Instance Method Details

#text(*text, **attribs, &block) ⇒ Object



16
17
18
19
# File 'lib/voom/presenters/dsl/components/tooltip.rb', line 16

def text(*text, **attribs, &block)
  return @text if locked?
  @text = Components::Typography.new(parent: self, type: :text, text: text, **attribs, &block)
end