Class: Bootstrap4RailsComponents::UI::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/bootstrap4_rails_components/ui/base.rb

Overview

The base component building class for namespaced components (bootstrap vs network_for_good / nfg)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(view_context) ⇒ Base

Returns a new instance of Base.



10
11
12
# File 'lib/bootstrap4_rails_components/ui/base.rb', line 10

def initialize(view_context)
  self.view_context = view_context
end

Instance Attribute Details

#view_contextObject

Returns the value of attribute view_context.



8
9
10
# File 'lib/bootstrap4_rails_components/ui/base.rb', line 8

def view_context
  @view_context
end

Instance Method Details

#bootstrap(component_name = nil, *traits, **options, &block) ⇒ Object



14
15
16
17
# File 'lib/bootstrap4_rails_components/ui/base.rb', line 14

def bootstrap(component_name = nil, *traits, **options, &block)
  return unless render_component?(options)
  Bootstrap4RailsComponents::UI::Bootstrap.new(view_context, component_name, *traits, **options, &block).render_component
end