Module: ControllerCommands::Command
- Defined in:
- lib/controller_commands/command.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
- #errors ⇒ Object
- #initialize(incoming_params, context) ⇒ Object
- #perform ⇒ Object
- #success_message ⇒ Object
- #validate_params ⇒ Object
- #validated? ⇒ Boolean
- #validated_params ⇒ Object
Class Method Details
.included(base) ⇒ Object
34 35 36 |
# File 'lib/controller_commands/command.rb', line 34 def self.included(base) base.extend(ClassMethods) end |
Instance Method Details
#errors ⇒ Object
47 48 49 |
# File 'lib/controller_commands/command.rb', line 47 def errors @result. end |
#initialize(incoming_params, context) ⇒ Object
38 39 40 41 |
# File 'lib/controller_commands/command.rb', line 38 def initialize(incoming_params, context) @incoming_params = incoming_params @context = context end |
#perform ⇒ Object
64 65 66 |
# File 'lib/controller_commands/command.rb', line 64 def perform self.class.perform(@context, validated_params) end |
#success_message ⇒ Object
60 61 62 |
# File 'lib/controller_commands/command.rb', line 60 def self.class. end |
#validate_params ⇒ Object
55 56 57 58 |
# File 'lib/controller_commands/command.rb', line 55 def validate_params @result = self.class.validate(@context, @incoming_params) @result..count == 0 end |
#validated? ⇒ Boolean
43 44 45 |
# File 'lib/controller_commands/command.rb', line 43 def validated? !!@result end |
#validated_params ⇒ Object
51 52 53 |
# File 'lib/controller_commands/command.rb', line 51 def validated_params @result.output end |