Class: Kpop::ModalComponent

Inherits:
ViewComponent::Base
  • Object
show all
Defined in:
app/components/kpop/modal_component.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(title:, modal_class:) ⇒ ModalComponent



7
8
9
10
11
12
# File 'app/components/kpop/modal_component.rb', line 7

def initialize(title:, modal_class:)
  super()

  @title       = title
  @modal_class = modal_class
end

Instance Attribute Details

#titleObject (readonly)

Returns the value of attribute title.



5
6
7
# File 'app/components/kpop/modal_component.rb', line 5

def title
  @title
end

Instance Method Details

#inspectObject



22
23
24
# File 'app/components/kpop/modal_component.rb', line 22

def inspect
  "#<#{self.class.name} title: #{title.inspect}>"
end

#labelObject



14
15
16
# File 'app/components/kpop/modal_component.rb', line 14

def label
  sanitize(title)
end


18
19
20
# File 'app/components/kpop/modal_component.rb', line 18

def modal_class
  @modal_class.to_s.dasherize
end