class OSHA::RubyFile

Constants

PROCESSOR

Public Class Methods

new(file_path) click to toggle source
# File lib/osha/ruby_file.rb, line 7
def initialize(file_path)
  @file_path = file_path
  @sexp = PROCESSOR.parse(File.read(file_path))
end

Public Instance Methods

apply_rules(rules) click to toggle source
# File lib/osha/ruby_file.rb, line 12
def apply_rules(rules)
  warnings = @sexp.deep_each.flat_map do |sexp|
    rules.map do |rule|
      rule.run(sexp)
    end
  end

  warnings.compact
end