Sha256: 893056922513d0b4fe556cfa438528efab361023f4ffab72f00b014f691a7628

Contents?: true

Size: 425 Bytes

Versions: 24

Compression:

Stored size: 425 Bytes

Contents

module Compony
  module ModelFields
    # Requires 'phonelib' gem
    class Phone < Base
      def initialize(...)
        fail('Please include gem "phonelib" to use the :phone field type.') unless defined?(Phonelib)
        super
      end

      def value_for(data, controller: nil, **_)
        return transform_and_join(data.send(@name), controller:) { |el| Phonelib.parse(el).international }
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
compony-0.5.2 lib/compony/model_fields/phone.rb
compony-0.5.1 lib/compony/model_fields/phone.rb
compony-0.5.0 lib/compony/model_fields/phone.rb
compony-0.4.1 lib/compony/model_fields/phone.rb
compony-0.4.0 lib/compony/model_fields/phone.rb
compony-0.3.3 lib/compony/model_fields/phone.rb
compony-0.3.2 lib/compony/model_fields/phone.rb
compony-0.3.1 lib/compony/model_fields/phone.rb
compony-0.3.0 lib/compony/model_fields/phone.rb
compony-0.2.3 lib/compony/model_fields/phone.rb
compony-0.2.2 lib/compony/model_fields/phone.rb
compony-0.2.1 lib/compony/model_fields/phone.rb
compony-0.2.0 lib/compony/model_fields/phone.rb
compony-0.1.1 lib/compony/model_fields/phone.rb
compony-0.1.0 lib/compony/model_fields/phone.rb
compony-0.0.9 lib/compony/model_fields/phone.rb
compony-0.0.8 lib/compony/model_fields/phone.rb
compony-0.0.7 lib/compony/model_fields/phone.rb
compony-0.0.6 lib/compony/model_fields/phone.rb
compony-0.0.5 lib/compony/model_fields/phone.rb