Class: AocCli::Components::ErrorsComponent
- Inherits:
-
Kangaru::Component
- Object
- Kangaru::Component
- AocCli::Components::ErrorsComponent
- Defined in:
- lib/aoc_cli/components/errors_component.rb
Instance Attribute Summary collapse
-
#messages ⇒ Object
readonly
Returns the value of attribute messages.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(*messages) ⇒ ErrorsComponent
constructor
A new instance of ErrorsComponent.
-
#render ⇒ Object
TODO: remove once Kangaru has native conditional rendering.
Constructor Details
#initialize(*messages) ⇒ ErrorsComponent
Returns a new instance of ErrorsComponent.
6 7 8 |
# File 'lib/aoc_cli/components/errors_component.rb', line 6 def initialize(*) @messages = end |
Instance Attribute Details
#messages ⇒ Object (readonly)
Returns the value of attribute messages.
4 5 6 |
# File 'lib/aoc_cli/components/errors_component.rb', line 4 def @messages end |
Class Method Details
.from_model(model) ⇒ Object
17 18 19 20 21 |
# File 'lib/aoc_cli/components/errors_component.rb', line 17 def self.from_model(model) errors = model.errors.map(&:full_message) new(*errors) end |
Instance Method Details
#render ⇒ Object
TODO: remove once Kangaru has native conditional rendering
11 12 13 14 15 |
# File 'lib/aoc_cli/components/errors_component.rb', line 11 def render return unless render? super end |