Sha256: 97b610fac3d05d6f47112515deee09fdc3a0f5217eacac20638257dab5ff0b04

Contents?: true

Size: 337 Bytes

Versions: 2

Compression:

Stored size: 337 Bytes

Contents

module UseDataFieldConcern
  extend ActiveSupport::Concern
  included do
    prepend(InstanceMethods)
  end

  module InstanceMethods

    def email
      data["email"]
    end

    def display_number
      cc_type == 'paypal' ? email : super
    end

    def data
      super.is_a?(String) ? JSON.parse(super) : super
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
solidus_braintree-0.2.1 app/models/concerns/use_data_field_concern.rb
solidus_braintree-0.2.0 app/models/concerns/use_data_field_concern.rb