Class: Relocator::CLI::Success

Inherits:
Object
  • Object
show all
Defined in:
lib/relocator/cli/success.rb

Overview

Determines if exactly one matching file was found. If so, it returns turth, otherwise it fails with adequate error message.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(files) ⇒ Success

Returns a new instance of Success.



11
12
13
# File 'lib/relocator/cli/success.rb', line 11

def initialize(files)
  self.files = files
end

Class Method Details

.call(*args) ⇒ Object



7
8
9
# File 'lib/relocator/cli/success.rb', line 7

def self.call(*args)
  new(*args).call
end

Instance Method Details

#callObject



15
16
17
18
19
20
21
22
23
24
# File 'lib/relocator/cli/success.rb', line 15

def call
  case files.length
  when 0
    raise Thor::Error, "Entity definition not found."
  when 1
    true
  else
    raise Thor::Error, multiple_files_error_message.join("\n")
  end
end