Class: Steep::AST::Ignore::IgnoreLine

Inherits:
Object
  • Object
show all
Defined in:
lib/steep/ast/ignore.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(comment, diagnostics, location) ⇒ IgnoreLine

Returns a new instance of IgnoreLine.



67
68
69
70
71
# File 'lib/steep/ast/ignore.rb', line 67

def initialize(comment, diagnostics, location)
  @comment = comment
  @raw_diagnostics = diagnostics
  @location = location
end

Instance Attribute Details

#commentObject (readonly)

Returns the value of attribute comment.



65
66
67
# File 'lib/steep/ast/ignore.rb', line 65

def comment
  @comment
end

#locationObject (readonly)

Returns the value of attribute location.



65
66
67
# File 'lib/steep/ast/ignore.rb', line 65

def location
  @location
end

#raw_diagnosticsObject (readonly)

Returns the value of attribute raw_diagnostics.



65
66
67
# File 'lib/steep/ast/ignore.rb', line 65

def raw_diagnostics
  @raw_diagnostics
end

Instance Method Details

#ignored_diagnosticsObject



77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/steep/ast/ignore.rb', line 77

def ignored_diagnostics
  if raw_diagnostics.empty?
    return :all
  end

  if raw_diagnostics.size == 1 && raw_diagnostics.fetch(0).source == "all"
    return :all
  end

  raw_diagnostics.map do |diagnostic|
    name = diagnostic[:name].source
    name.gsub(/\ARuby::/, "")
  end
end

#lineObject



73
74
75
# File 'lib/steep/ast/ignore.rb', line 73

def line
  location.start_line
end