Class: Hecks::Application::Commands::Update

Inherits:
Object
  • Object
show all
Defined in:
lib/commands/update.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args: nil, repository: Repository, domain_module:) ⇒ Update

Returns a new instance of Update.



8
9
10
11
12
13
# File 'lib/commands/update.rb', line 8

def initialize(args: nil, repository: Repository, domain_module:)
  @repository      = repository
  @args            = args
  @errors          = []
  @id              = @args.delete(:id)
end

Instance Attribute Details

#argsObject

Returns the value of attribute args.



6
7
8
# File 'lib/commands/update.rb', line 6

def args
  @args
end

#errorsObject

Returns the value of attribute errors.



6
7
8
# File 'lib/commands/update.rb', line 6

def errors
  @errors
end

#idObject

Returns the value of attribute id.



6
7
8
# File 'lib/commands/update.rb', line 6

def id
  @id
end

#repositoryObject

Returns the value of attribute repository.



6
7
8
# File 'lib/commands/update.rb', line 6

def repository
  @repository
end

Instance Method Details

#callObject



19
20
21
22
# File 'lib/commands/update.rb', line 19

def call
  update
  self
end

#nameObject



15
16
17
# File 'lib/commands/update.rb', line 15

def name
  self.class.to_s.split('::').last.underscore
end

#to_hObject



24
25
26
# File 'lib/commands/update.rb', line 24

def to_h
  { id: id, args: args }
end