Class: LcpRuby::I18nCheck::Offense

Inherits:
Struct
  • Object
show all
Defined in:
lib/lcp_ruby/i18n_check/offense.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#contentObject

Returns the value of attribute content

Returns:

  • (Object)

    the current value of content



3
4
5
# File 'lib/lcp_ruby/i18n_check/offense.rb', line 3

def content
  @content
end

#fileObject

Returns the value of attribute file

Returns:

  • (Object)

    the current value of file



3
4
5
# File 'lib/lcp_ruby/i18n_check/offense.rb', line 3

def file
  @file
end

#keysObject

Returns the value of attribute keys

Returns:

  • (Object)

    the current value of keys



3
4
5
# File 'lib/lcp_ruby/i18n_check/offense.rb', line 3

def keys
  @keys
end

#kindObject

Returns the value of attribute kind

Returns:

  • (Object)

    the current value of kind



3
4
5
# File 'lib/lcp_ruby/i18n_check/offense.rb', line 3

def kind
  @kind
end

#lineObject

Returns the value of attribute line

Returns:

  • (Object)

    the current value of line



3
4
5
# File 'lib/lcp_ruby/i18n_check/offense.rb', line 3

def line
  @line
end

#methodObject

Returns the value of attribute method

Returns:

  • (Object)

    the current value of method



3
4
5
# File 'lib/lcp_ruby/i18n_check/offense.rb', line 3

def method
  @method
end

#missing_inObject

Returns the value of attribute missing_in

Returns:

  • (Object)

    the current value of missing_in



3
4
5
# File 'lib/lcp_ruby/i18n_check/offense.rb', line 3

def missing_in
  @missing_in
end

#severityObject

Returns the value of attribute severity

Returns:

  • (Object)

    the current value of severity



3
4
5
# File 'lib/lcp_ruby/i18n_check/offense.rb', line 3

def severity
  @severity
end

#suggested_fixObject

Returns the value of attribute suggested_fix

Returns:

  • (Object)

    the current value of suggested_fix



3
4
5
# File 'lib/lcp_ruby/i18n_check/offense.rb', line 3

def suggested_fix
  @suggested_fix
end

#valueObject

Returns the value of attribute value

Returns:

  • (Object)

    the current value of value



3
4
5
# File 'lib/lcp_ruby/i18n_check/offense.rb', line 3

def value
  @value
end

Instance Method Details

#error?Boolean

Returns:

  • (Boolean)


9
# File 'lib/lcp_ruby/i18n_check/offense.rb', line 9

def error?;   severity == :error;   end

#info?Boolean

Returns:

  • (Boolean)


11
# File 'lib/lcp_ruby/i18n_check/offense.rb', line 11

def info?;    severity == :info;    end

#to_h_v1Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/lcp_ruby/i18n_check/offense.rb', line 13

def to_h_v1
  {
    file: file,
    line: line,
    kind: kind&.to_s,
    severity: severity&.to_s,
    method: method&.to_s,
    content: content,
    value: value,
    suggested_fix: suggested_fix,
    keys: keys,
    missing_in: Array(missing_in).map(&:to_s)
  }
end

#warning?Boolean

Returns:

  • (Boolean)


10
# File 'lib/lcp_ruby/i18n_check/offense.rb', line 10

def warning?; severity == :warning; end