Class: Bulma::TitleComponent

Inherits:
Component
  • Object
show all
Defined in:
app/components/bulma/title_component.rb

Instance Method Summary collapse

Constructor Details

#initialize(title = nil, as: :h1, size: 1) ⇒ TitleComponent

Returns a new instance of TitleComponent.

Raises:

  • (ArgumentError)


5
6
7
8
9
10
11
# File 'app/components/bulma/title_component.rb', line 5

def initialize(title = nil, as: :h1, size: 1)
  raise ArgumentError, "invalid value to size" if size > 6

  @title = title
  @as = as
  @size = size
end

Instance Method Details

#callObject



13
14
15
16
17
18
# File 'app/components/bulma/title_component.rb', line 13

def call
   @as, @title || content, class: class_names(
    "title",
    "is-#{@size}"
  )
end