ministryofjustice/Claim-for-Crown-Court-Defence

View on GitHub
app/models/concerns/number_comma_parser.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
module NumberCommaParser
  extend ActiveSupport::Concern

  module ClassMethods
    def numeric_attributes(*attributes)
      attributes.each do |attribute|
        define_method(:"#{attribute}=") do |value|
          self[attribute] = value.is_a?(String) ? value.delete(',') : value
        end
      end
    end
  end
end