Class: Flexite::Data::NewService
- Inherits:
-
Object
- Object
- Flexite::Data::NewService
- Defined in:
- app/services/flexite/data/new_service.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(migrator) ⇒ NewService
constructor
A new instance of NewService.
Constructor Details
#initialize(migrator) ⇒ NewService
Returns a new instance of NewService.
4 5 6 7 8 |
# File 'app/services/flexite/data/new_service.rb', line 4 def initialize(migrator) @migrator = migrator @errors = ::Hash.new { |h, k| h[k] = [] } @result = {} end |
Instance Method Details
#call ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/services/flexite/data/new_service.rb', line 10 def call @migrator.call.each do |root, configs| begin @result[root] = save_root(root, configs) rescue => exc @errors[root] << [exc., exc.backtrace] end end @result.tap do |result| result[:errors] = @errors end end |