Class: Frails::Component::PlainComponent
- Inherits:
-
AbstractComponent
- Object
- AbstractComponent
- Frails::Component::PlainComponent
- Defined in:
- lib/frails/component/plain_component.rb
Constant Summary collapse
- PRIVATE_METHODS =
%i[render method_missing locals].freeze
Instance Method Summary collapse
-
#initialize(view, options) ⇒ PlainComponent
constructor
A new instance of PlainComponent.
- #locals ⇒ Object
Methods inherited from AbstractComponent
after_render, before_render, #method_missing
Constructor Details
#initialize(view, options) ⇒ PlainComponent
Returns a new instance of PlainComponent.
6 7 8 9 10 |
# File 'lib/frails/component/plain_component.rb', line 6 def initialize(view, ) super @locals = @options.fetch(:locals, @options) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Frails::Component::AbstractComponent
Instance Method Details
#locals ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/frails/component/plain_component.rb', line 12 def locals hash = {} public_methods(false).each do |method| hash[method] = send(method) unless PRIVATE_METHODS.include?(method) end hash.merge @locals end |