Sha256: 0cb6be6762cfce3e18826cdabe09769a7a9bb7178c5f88c2d20543d48bc60652
Contents?: true
Size: 1.14 KB
Versions: 3
Compression:
Stored size: 1.14 KB
Contents
require 'active_support' require 'remote_table' require 'erratum' require 'erratum/delete' require 'erratum/reject' require 'erratum/replace' require 'erratum/simplify' require 'erratum/transform' require 'erratum/truncate' class Errata ERRATUM_TYPES = %w{delete replace simplify transform truncate} attr_reader :klass def initialize(options = {}) @klass = options[:klass] @_table = RemoteTable.new(:url => options[:url]) end def rejects?(row) rejections.any? { |erratum| erratum.targets?(row) } end def correct!(row) corrections.each { |erratum| erratum.correct!(row) } nil end def implied_matching_methods (rejections + corrections).map { |erratum| erratum.matching_method }.compact.uniq end private def rejections @_rejections ||= @_table.rows.map { |hash| hash.symbolize_keys!; ::Errata::Erratum::Reject.new(self, hash) if hash[:action] == 'reject' }.compact end def corrections @_corrections ||= @_table.rows.map { |hash| hash.symbolize_keys!; "::Errata::Erratum::#{hash[:action].camelcase}".constantize.new(self, hash) if ERRATUM_TYPES.include?(hash[:action]) }.compact end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
errata-0.1.7 | lib/errata.rb |
errata-0.1.6 | lib/errata.rb |
errata-0.1.5 | lib/errata.rb |