Class: Errata::Erratum::Transform
- Inherits:
-
Errata::Erratum
- Object
- Errata::Erratum
- Errata::Erratum::Transform
- Defined in:
- lib/errata/erratum/transform.rb
Constant Summary collapse
- ALLOWED_METHODS =
%w{upcase downcase}
Constants inherited from Errata::Erratum
REJECT_ACTIONS, SEMICOLON_DELIMITER, SPECIAL_ABBR
Instance Attribute Summary collapse
-
#string_method ⇒ Object
readonly
Returns the value of attribute string_method.
Attributes inherited from Errata::Erratum
#matching_expression, #matching_methods, #responder, #section
Instance Method Summary collapse
- #correct!(row) ⇒ Object
-
#initialize(responder, options = {}) ⇒ Transform
constructor
A new instance of Transform.
Methods inherited from Errata::Erratum
#abbr?, #conditions_match?, #expression_matches?, #targets?
Constructor Details
#initialize(responder, options = {}) ⇒ Transform
Returns a new instance of Transform.
8 9 10 11 12 |
# File 'lib/errata/erratum/transform.rb', line 8 def initialize(responder, = {}) super @string_method = [:y] raise %{[errata] Method "#{@string_method}" not allowed} unless ALLOWED_METHODS.include? @string_method end |
Instance Attribute Details
#string_method ⇒ Object (readonly)
Returns the value of attribute string_method.
6 7 8 |
# File 'lib/errata/erratum/transform.rb', line 6 def string_method @string_method end |
Instance Method Details
#correct!(row) ⇒ Object
14 15 16 17 18 |
# File 'lib/errata/erratum/transform.rb', line 14 def correct!(row) if targets? row row[section].gsub!(matching_expression) { |match| match.send string_method } end end |