Class: FlareUp::STLLoadError
- Inherits:
-
Object
- Object
- FlareUp::STLLoadError
- Defined in:
- lib/flare_up/stl_load_error.rb
Instance Attribute Summary collapse
-
#col_length ⇒ Object
readonly
Returns the value of attribute col_length.
-
#colname ⇒ Object
readonly
Returns the value of attribute colname.
-
#err_reason ⇒ Object
readonly
Returns the value of attribute err_reason.
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
-
#line_number ⇒ Object
readonly
Returns the value of attribute line_number.
-
#position ⇒ Object
readonly
Returns the value of attribute position.
-
#raw_field_value ⇒ Object
readonly
Returns the value of attribute raw_field_value.
-
#raw_line ⇒ Object
readonly
Returns the value of attribute raw_line.
-
#start_time ⇒ Object
readonly
Returns the value of attribute start_time.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other_error) ⇒ Object
-
#initialize(err_reason, raw_field_value, raw_line, col_length, type, colname, filename, position, line_number, start_time) ⇒ STLLoadError
constructor
A new instance of STLLoadError.
- #pretty_print ⇒ Object
Constructor Details
#initialize(err_reason, raw_field_value, raw_line, col_length, type, colname, filename, position, line_number, start_time) ⇒ STLLoadError
Returns a new instance of STLLoadError.
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/flare_up/stl_load_error.rb', line 16 def initialize(err_reason, raw_field_value, raw_line, col_length, type, colname, filename, position, line_number, start_time) @err_reason = err_reason @raw_field_value = raw_field_value @raw_line = raw_line @col_length = col_length @type = type @colname = colname @filename = filename @position = position @line_number = line_number @start_time = start_time end |
Instance Attribute Details
#col_length ⇒ Object (readonly)
Returns the value of attribute col_length.
8 9 10 |
# File 'lib/flare_up/stl_load_error.rb', line 8 def col_length @col_length end |
#colname ⇒ Object (readonly)
Returns the value of attribute colname.
10 11 12 |
# File 'lib/flare_up/stl_load_error.rb', line 10 def colname @colname end |
#err_reason ⇒ Object (readonly)
Returns the value of attribute err_reason.
5 6 7 |
# File 'lib/flare_up/stl_load_error.rb', line 5 def err_reason @err_reason end |
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
11 12 13 |
# File 'lib/flare_up/stl_load_error.rb', line 11 def filename @filename end |
#line_number ⇒ Object (readonly)
Returns the value of attribute line_number.
13 14 15 |
# File 'lib/flare_up/stl_load_error.rb', line 13 def line_number @line_number end |
#position ⇒ Object (readonly)
Returns the value of attribute position.
12 13 14 |
# File 'lib/flare_up/stl_load_error.rb', line 12 def position @position end |
#raw_field_value ⇒ Object (readonly)
Returns the value of attribute raw_field_value.
6 7 8 |
# File 'lib/flare_up/stl_load_error.rb', line 6 def raw_field_value @raw_field_value end |
#raw_line ⇒ Object (readonly)
Returns the value of attribute raw_line.
7 8 9 |
# File 'lib/flare_up/stl_load_error.rb', line 7 def raw_line @raw_line end |
#start_time ⇒ Object (readonly)
Returns the value of attribute start_time.
14 15 16 |
# File 'lib/flare_up/stl_load_error.rb', line 14 def start_time @start_time end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
9 10 11 |
# File 'lib/flare_up/stl_load_error.rb', line 9 def type @type end |
Class Method Details
.from_pg_results_row(row) ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/flare_up/stl_load_error.rb', line 55 def self.from_pg_results_row(row) STLLoadError.new( row['err_reason'].strip, row['raw_field_value'].strip, row['raw_line'].strip, row['col_length'].strip.to_i, row['type'].strip, row['colname'].strip, row['filename'].strip, row['position'].strip.to_i, row['line_number'].strip.to_i, Time.parse("#{row['starttime'].strip} UTC'") ) end |
Instance Method Details
#==(other_error) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/flare_up/stl_load_error.rb', line 29 def ==(other_error) return false unless @err_reason == other_error.err_reason return false unless @raw_field_value == other_error.raw_field_value return false unless @raw_line == other_error.raw_line return false unless @col_length == other_error.col_length return false unless @type == other_error.type return false unless @colname == other_error.colname return false unless @filename == other_error.filename return false unless @position == other_error.position return false unless @line_number == other_error.line_number return false unless @start_time == other_error.start_time true end |
#pretty_print ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/flare_up/stl_load_error.rb', line 43 def pretty_print output = '' output += "\e[33mSTART : \e[37m#{@start_time} (#{@start_time - 7 * 60 * 60} PST)\n" output += "\e[33mREASON: \e[37m#{@err_reason}\n" output += "\e[33mLINE : \e[37m#{@line_number}\n" output += "\e[33mPOS : \e[37m#{@position}\n" output += "\e[33mCOLUMN: \e[37m#{@colname} (LENGTH=#{@col_length})\n" if @colname.length > 0 && @col_length > 0 output += "\e[33mTYPE : \e[37m#{@type}\n" if @type.length > 0 output += "\e[33mLINE : \e[37m#{@raw_line}\n" output += " \e[37m#{' ' * @position}^" end |