Class: AdLint::Analyzer

Inherits:
Object
  • Object
show all
Defined in:
lib/adlint/analyzer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, traits, msg_catalog, target_name, output_dpath, log_basename, verbose) ⇒ Analyzer

Returns a new instance of Analyzer.



48
49
50
51
52
53
54
55
56
57
58
# File 'lib/adlint/analyzer.rb', line 48

def initialize(name, traits, msg_catalog, target_name, output_dpath,
               log_basename, verbose)
  @name            = name
  @traits          = traits
  @message_catalog = msg_catalog
  @target_name     = target_name
  @output_dpath    = output_dpath
  @log_basename    = log_basename
  @verbose         = verbose
  @logger          = nil
end

Instance Attribute Details

#loggerObject (readonly)

Returns the value of attribute logger.



62
63
64
# File 'lib/adlint/analyzer.rb', line 62

def logger
  @logger
end

#message_catalogObject (readonly)

Returns the value of attribute message_catalog.



61
62
63
# File 'lib/adlint/analyzer.rb', line 61

def message_catalog
  @message_catalog
end

#traitsObject (readonly)

Returns the value of attribute traits.



60
61
62
# File 'lib/adlint/analyzer.rb', line 60

def traits
  @traits
end

Instance Method Details

#runObject



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/adlint/analyzer.rb', line 64

def run
  File.open(log_fpath, "w") do |log_io|
    @logger = Logger.new(log_io).tap { |logger|
      logger.progname = @name
      logger.datetime_format = "%F %T "
    }
    begin
      log_start_analysis
      execute(ProgressMonitor.new(@target_name, phases.size, @verbose))
    rescue => ex
      @logger.fatal(ex)
      return false
    end
  end
  true
end