Class: Warb::Components::UrlButton

Inherits:
Button show all
Defined in:
lib/warb/components/url_button.rb

Constant Summary collapse

BUTTON_TYPE =
'url'

Instance Attribute Summary collapse

Attributes inherited from Button

#index, #sub_type

Instance Method Summary collapse

Methods inherited from Button

#initialize

Methods inherited from Component

#initialize

Constructor Details

This class inherits a constructor from Warb::Components::Button

Instance Attribute Details

#textObject

Returns the value of attribute text.



8
9
10
# File 'lib/warb/components/url_button.rb', line 8

def text
  @text
end

Instance Method Details

#to_hObject



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/warb/components/url_button.rb', line 10

def to_h
  button_payload = super

  if text || @params[:text]
    button_payload[:parameters] = Array.new(1, {
                                              type: 'text',
                                              text: text || @params[:text]
                                            })
  end

  button_payload
end