Class: Fdlint::LogEntry

Inherits:
Struct
  • Object
show all
Defined in:
lib/fdlint/log_entry.rb

Direct Known Subclasses

InvalidFileEncoding, Parser::VisitResult

Constant Summary collapse

LEVEL_CONST =
{
  :warn => 1,
  :error => 2,
  :fatal => 3
}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, level, row = 0, colmn = 0) ⇒ LogEntry

Returns a new instance of LogEntry.



10
11
12
# File 'lib/fdlint/log_entry.rb', line 10

def initialize(message, level, row = 0, colmn = 0)
  super
end

Instance Attribute Details

#columnObject

Returns the value of attribute column

Returns:

  • (Object)

    the current value of column



6
7
8
# File 'lib/fdlint/log_entry.rb', line 6

def column
  @column
end

#levelObject

Returns the value of attribute level

Returns:

  • (Object)

    the current value of level



6
7
8
# File 'lib/fdlint/log_entry.rb', line 6

def level
  @level
end

#messageObject

Returns the value of attribute message

Returns:

  • (Object)

    the current value of message



6
7
8
# File 'lib/fdlint/log_entry.rb', line 6

def message
  @message
end

#rowObject

Returns the value of attribute row

Returns:

  • (Object)

    the current value of row



6
7
8
# File 'lib/fdlint/log_entry.rb', line 6

def row
  @row
end

#validationObject

Returns the value of attribute validation.



8
9
10
# File 'lib/fdlint/log_entry.rb', line 8

def validation
  @validation
end

Class Method Details

.level_greater_or_equal?(a, b) ⇒ Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/fdlint/log_entry.rb', line 48

def self.level_greater_or_equal?( a, b )
  level_number(a) >= level_number(b)
end

.level_number(symb) ⇒ Object



52
53
54
# File 'lib/fdlint/log_entry.rb', line 52

def self.level_number( symb )
  LEVEL_CONST[symb]
end

Instance Method Details

#descObject



38
39
40
# File 'lib/fdlint/log_entry.rb', line 38

def desc
  validation && validation.long_desc
end

#error?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/fdlint/log_entry.rb', line 22

def error?
  level == :error
end

#fatal?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/fdlint/log_entry.rb', line 30

def fatal?
  level == :fatal
end

#info?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/fdlint/log_entry.rb', line 34

def info?
  level == :info
end

#posObject



18
19
20
# File 'lib/fdlint/log_entry.rb', line 18

def pos
  row.nil? ? "" : "[#{row},#{column}]"
end

#to_sObject



14
15
16
# File 'lib/fdlint/log_entry.rb', line 14

def to_s
  "[#{level.to_s.upcase}] #{pos} #{message}"
end

#warn?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/fdlint/log_entry.rb', line 26

def warn?
  level == :warn
end