Class: JRuby::Lint::Finding

Inherits:
Struct
  • Object
show all
Defined in:
lib/jruby/lint/finding.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Finding

Returns a new instance of Finding.



3
4
5
6
7
8
9
# File 'lib/jruby/lint/finding.rb', line 3

def initialize(*args)
  args[1].map! {|x| x.to_s } if args.size > 1
  if args.size > 2 && args[2].respond_to?(:file) && args[2].respond_to?(:line)
    args = [args[0], args[1], args[2].file, (args[2].line + 1)]
  end
  super
end

Instance Attribute Details

#fileObject

Returns the value of attribute file

Returns:

  • (Object)

    the current value of file



2
3
4
# File 'lib/jruby/lint/finding.rb', line 2

def file
  @file
end

#lineObject

Returns the value of attribute line

Returns:

  • (Object)

    the current value of line



2
3
4
# File 'lib/jruby/lint/finding.rb', line 2

def line
  @line
end

#messageObject

Returns the value of attribute message

Returns:

  • (Object)

    the current value of message



2
3
4
# File 'lib/jruby/lint/finding.rb', line 2

def message
  @message
end

#tagsObject

Returns the value of attribute tags

Returns:

  • (Object)

    the current value of tags



2
3
4
# File 'lib/jruby/lint/finding.rb', line 2

def tags
  @tags
end

Instance Method Details

#error?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/jruby/lint/finding.rb', line 11

def error?
  tags.include?('error')
end

#to_sObject



19
20
21
# File 'lib/jruby/lint/finding.rb', line 19

def to_s
  "#{file}:#{line}: [#{tags.join(', ')}] #{message}"
end

#warning?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/jruby/lint/finding.rb', line 15

def warning?
  tags.include?('warning')
end