Module: RailsComponents

Defined in:
lib/rails_components.rb

Constant Summary collapse

COMPONENT_RESERVED_WORDS =
%i(class return super).freeze

Instance Method Summary collapse

Instance Method Details

#component(component_template, text_or_locals_with_block = nil, locals = nil, &block) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/rails_components.rb', line 4

def component(component_template, text_or_locals_with_block = nil, locals = nil, &block)
  if block_given?
    render({ layout: component_template, locals: component_locals(text_or_locals_with_block) }, &block)
  else
    render(layout: component_template, locals: component_locals(locals)) { text_or_locals_with_block }
  end
end