Sha256: 73b54f39ff0c84164dce00c379b777833f45f55af7d6e85bc784765cfd278d03

Contents?: true

Size: 343 Bytes

Versions: 1

Compression:

Stored size: 343 Bytes

Contents

module FormattedLength
  module ModelAdditions
    def acts_as_formatted_length(field = :length)
      define_method :formatted_length do
        FormattedLength.format_to_s(send(field))
      end
      define_method :formatted_length= do |value|
        send("#{field}=".to_sym, FormattedLength.format_to_i(value))
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
formatted_length-0.0.7 lib/formatted_length/model_additions.rb