Class: DatabaseConsistency::RescueError

Inherits:
Object
  • Object
show all
Defined in:
lib/database_consistency/rescue_error.rb

Overview

The class writes error to the file

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRescueError

Returns a new instance of RescueError.



15
16
17
18
19
20
# File 'lib/database_consistency/rescue_error.rb', line 15

def initialize
  puts 'Hey, some of checks fail with an error, please open an issue on github at https://github.com/djezzzl/database_consistency.'
  puts "Attach the created file: #{filename}"
  puts 'Thank you, for your contribution!'
  puts '(c) Evgeniy Demin <[email protected]>'
end

Instance Attribute Details

#errorObject (readonly)

Returns the value of attribute error.



6
7
8
# File 'lib/database_consistency/rescue_error.rb', line 6

def error
  @error
end

Class Method Details

.call(error) ⇒ Object



10
11
12
13
# File 'lib/database_consistency/rescue_error.rb', line 10

def self.call(error)
  @singleton ||= new
  @singleton.call(error)
end

Instance Method Details

#call(error) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/database_consistency/rescue_error.rb', line 22

def call(error)
  File.open(filename, 'a') do |file|
    file.puts('<===begin===>')
    file.puts(error.full_message)
    file.puts('<===end===>')
  end
end