Class: Assistant::Service

Inherits:
Object
  • Object
show all
Includes:
LogList
Defined in:
lib/assistant/service.rb

Overview

Base class for the Assistant gem

Class Method Summary collapse

Instance Method Summary collapse

Methods included from LogList

#add_log, #merge_logs

Constructor Details

#initialize(*args) ⇒ Service

Returns a new instance of Service.



14
15
16
17
# File 'lib/assistant/service.rb', line 14

def initialize(*args)
  @inputs = args
  @logs = []
end

Class Method Details

.run(*args) ⇒ Object



9
10
11
# File 'lib/assistant/service.rb', line 9

def run(*args)
  new(*args).run
end

Instance Method Details

#runObject



19
20
21
22
# File 'lib/assistant/service.rb', line 19

def run
  validate
  { result: execute, status: status, warnings: warnings } if errors.empty?
end

#statusObject



24
25
26
# File 'lib/assistant/service.rb', line 24

def status
  warnings.empty? ? :ok : :with_warnings
end