Class: Nquery::CardComponent

Inherits:
Component show all
Defined in:
app/components/nquery/card_component.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Component

render_in, #render_in

Constructor Details

#initialize(title: nil, class: nil) ⇒ CardComponent

Returns a new instance of CardComponent.



7
8
9
10
# File 'app/components/nquery/card_component.rb', line 7

def initialize(title: nil, class: nil)
  @title = title
  @html_class = binding.local_variable_get(:class)
end

Instance Attribute Details

#html_classObject (readonly)

Returns the value of attribute html_class.



5
6
7
# File 'app/components/nquery/card_component.rb', line 5

def html_class
  @html_class
end

#titleObject (readonly)

Returns the value of attribute title.



5
6
7
# File 'app/components/nquery/card_component.rb', line 5

def title
  @title
end

Instance Method Details

#css_classObject



12
13
14
15
16
# File 'app/components/nquery/card_component.rb', line 12

def css_class
  classes = ["nq-card"]
  classes << html_class if html_class.present?
  classes.join(" ")
end