Class: Errata::Erratum::Transform

Inherits:
Errata::Erratum show all
Defined in:
lib/errata/erratum/transform.rb

Constant Summary collapse

ALLOWED_METHODS =
%w{upcase downcase}

Instance Attribute Summary

Attributes inherited from Errata::Erratum

#errata, #options

Instance Method Summary collapse

Methods inherited from Errata::Erratum

#conditions_match?, #expression_matches?, #initialize, #matching_expression, #matching_methods, #responder, #section, #targets?

Constructor Details

This class inherits a constructor from Errata::Erratum

Instance Method Details

#correct!(row) ⇒ Object


11
12
13
14
15
# File 'lib/errata/erratum/transform.rb', line 11

def correct!(row)
  if targets? row
    row[section].gsub!(matching_expression) { |match| match.send string_method }
  end
end

#string_methodObject


6
7
8
9
# File 'lib/errata/erratum/transform.rb', line 6

def string_method
  raise %{string method "#{options['y']}" not allowed} unless ALLOWED_METHODS.include? options['y']
  options['y']
end