Sha256: b66ef23637bf2b8ffd49c5f7171299136180ae0e23e76933699f95fe9968c57c

Contents?: true

Size: 764 Bytes

Versions: 8

Compression:

Stored size: 764 Bytes

Contents

module Praxis
 class Collection < Attributor::Collection
    include Types::MediaTypeCommon

    def self.of(type)
      if defined?(type::Collection)
        return type::Collection
      end

      klass = super

      if type < Praxis::Types::MediaTypeCommon
        unless type.identifier.nil?
          klass.identifier(type.identifier + ';type=collection')
        end

        type.const_set :Collection, klass
      else
        warn "DEPRECATION: Praxis::Collection.of() for non-MediaTypes will be unsupported in 1.0. Use Attributor::Collection.of() instead."
        Attributor::Collection.of(type)
      end

    end

    def self.member_type(type=nil)
      unless type.nil?
        @member_type = type
      end

      @member_type
    end

  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
praxis-0.18.1 lib/praxis/collection.rb
praxis-0.18.0 lib/praxis/collection.rb
praxis-0.17.1 lib/praxis/collection.rb
praxis-0.17.0 lib/praxis/collection.rb
praxis-0.16.1 lib/praxis/collection.rb
praxis-0.16.0 lib/praxis/collection.rb
praxis-0.15.0 lib/praxis/collection.rb
praxis-0.14.0 lib/praxis/collection.rb