Sha256: 3325ebf176cdfe9e66d39d78194cb939767d9f2b146e997509dd3e15d8fd83e0

Contents?: true

Size: 575 Bytes

Versions: 7

Compression:

Stored size: 575 Bytes

Contents

module Balanced

  module HypermediaRegistry

    def self.included(base) # :nodoc:
      base.extend ClassMethods
    end

    module ClassMethods

      def define_hypermedia_types(types)
        @hypermedia_types = types.map! do |t|
          t.to_s
        end.sort!.freeze

        @hypermedia_types.each do |type|
          Balanced.hypermedia_registry[type] = self
        end
      end

      # @return [Array, nil] The list of hypermedia types this class is
      # mapped to for interacting with the resource.
      attr_reader :hypermedia_types
    end

  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
balanced-1.2.1 lib/balanced/resources/hypermedia.rb
balanced-1.1.1 lib/balanced/resources/hypermedia.rb
balanced-1.1.0 lib/balanced/resources/hypermedia.rb
balanced-1.0.2 lib/balanced/resources/hypermedia.rb
balanced-1.0.1 lib/balanced/resources/hypermedia.rb
balanced-1.0 lib/balanced/resources/hypermedia.rb
balanced-1.0.beta1 lib/balanced/resources/hypermedia.rb