Sha256: 185a0587701adfcaa357a6daaed3e514d7f4d267e84f50fa6499cfc06852a9d6

Contents?: true

Size: 535 Bytes

Versions: 1

Compression:

Stored size: 535 Bytes

Contents

module ActiveData
  module Model
    module Extensions
      module Array
        extend ActiveSupport::Concern

        def demodelize
          join(', ')
        end

        module ClassMethods
          def modelize value
            case value
            when String then
              value.split(',').map(&:strip)
            when Array then
              value
            else
              nil
            end
          end
        end
      end
    end
  end
end

Array.send :include, ActiveData::Model::Extensions::Array

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
active_data-0.0.1 lib/active_data/model/extensions/array.rb