class Supercop::Parsers::Proxy

Constants

RUBOCOP

Attributes

json[R]
linter[R]
parser[R]

Public Class Methods

new(json, linter) click to toggle source
# File lib/supercop/parsers/proxy.rb, line 8
def initialize(json, linter)
  @linter = linter
  @json = json
  @parser = find_parser
end

Public Instance Methods

parse() click to toggle source
# File lib/supercop/parsers/proxy.rb, line 14
def parse
  parser.call
end

Private Instance Methods

find_parser() click to toggle source
# File lib/supercop/parsers/proxy.rb, line 20
def find_parser
  return Rubocop.new(json) if rubocop_like_parser?

  ('Supercop::Parsers::' + linter.classify).constantize.new(json)
rescue NameError
  Base.new(json)
end
rubocop_like_parser?() click to toggle source
# File lib/supercop/parsers/proxy.rb, line 28
def rubocop_like_parser?
  RUBOCOP.include?(linter.classify)
end