Class: Hecks::Application::Commands::Create
- Inherits:
-
Object
- Object
- Hecks::Application::Commands::Create
- Defined in:
- lib/commands/create.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
Returns the value of attribute args.
-
#domain_module ⇒ Object
Returns the value of attribute domain_module.
-
#errors ⇒ Object
Returns the value of attribute errors.
-
#id ⇒ Object
Returns the value of attribute id.
-
#repository ⇒ Object
Returns the value of attribute repository.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(args:, repository:, domain_module:) ⇒ Create
constructor
A new instance of Create.
- #name ⇒ Object
- #result ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(args:, repository:, domain_module:) ⇒ Create
Returns a new instance of Create.
8 9 10 11 12 13 14 |
# File 'lib/commands/create.rb', line 8 def initialize(args:, repository:, domain_module: ) @repository = repository @args = args @errors = {} @validator = Hecks::Adapters::Validator @domain_module = domain_module end |
Instance Attribute Details
#args ⇒ Object
Returns the value of attribute args.
6 7 8 |
# File 'lib/commands/create.rb', line 6 def args @args end |
#domain_module ⇒ Object
Returns the value of attribute domain_module.
6 7 8 |
# File 'lib/commands/create.rb', line 6 def domain_module @domain_module end |
#errors ⇒ Object
Returns the value of attribute errors.
6 7 8 |
# File 'lib/commands/create.rb', line 6 def errors @errors end |
#id ⇒ Object
Returns the value of attribute id.
6 7 8 |
# File 'lib/commands/create.rb', line 6 def id @id end |
#repository ⇒ Object
Returns the value of attribute repository.
6 7 8 |
# File 'lib/commands/create.rb', line 6 def repository @repository end |
Instance Method Details
#call ⇒ Object
16 17 18 19 20 |
# File 'lib/commands/create.rb', line 16 def call validate create self end |
#name ⇒ Object
26 27 28 |
# File 'lib/commands/create.rb', line 26 def name self.class.to_s.split('::').last.underscore end |
#result ⇒ Object
30 31 32 |
# File 'lib/commands/create.rb', line 30 def result { id: id, success: !id.nil?, errors: errors, args: args } end |
#to_h ⇒ Object
22 23 24 |
# File 'lib/commands/create.rb', line 22 def to_h { errors: errors, id: repository_result, args: args } end |