Class: Polaris::Action

Inherits:
Object
  • Object
show all
Defined in:
app/components/polaris/action.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(content:, url:, accessibility_label: "", external: false, id: "", data: {}) ⇒ Action

Returns a new instance of Action.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/components/polaris/action.rb', line 5

def initialize(
  content:,
  url:,
  accessibility_label: "",
  external: false,
  id: "",
  data: {}
)
  @content = content
  @accessibility_label = accessibility_label
  @external = external
  @id = id
  @url = url
  @data = data
end

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content.



3
4
5
# File 'app/components/polaris/action.rb', line 3

def content
  @content
end

Instance Method Details

#to_hObject



21
22
23
24
25
26
27
28
29
30
# File 'app/components/polaris/action.rb', line 21

def to_h
  {
    content: @content,
    accessibility_label: @accessibility_label,
    external: @external,
    id: @id,
    url: @url,
    data: @data
  }
end