Module: Components
- Defined in:
- lib/components.rb,
lib/components/base.rb
Overview
:nodoc:
Defined Under Namespace
Modules: ActionController, ActionView, Caching Classes: Base, View
Class Method Summary collapse
- .merge_standard_component_options!(args, standard_options, arity) ⇒ Object
- .render(name, component_args = [], options = {}) ⇒ Object
Class Method Details
.merge_standard_component_options!(args, standard_options, arity) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/components.rb', line 11 def self.(args, , arity) if # when the method's arity is positive, it only accepts a fixed list of arguments, so we can't add another. args << {} unless args.last.is_a?(Hash) or not arity < 0 args.last.reverse_merge!() if args.last.is_a?(Hash) end end |
.render(name, component_args = [], options = {}) ⇒ Object
2 3 4 5 6 7 8 9 |
# File 'lib/components.rb', line 2 def self.render(name, component_args = [], = {}) klass, method = name.split('/') component = (klass + "_component").camelcase.constantize.new component.form_authenticity_token = [:form_authenticity_token] (component_args, [:standard_component_options], component.method(method).arity) component.logger.debug "Rendering component #{name}" component.send(method, *component_args).to_s end |