Sha256: 8343b7e541570dec533e53f097cb0fa948d67604237dde073f37a4b5c7bc6385

Contents?: true

Size: 583 Bytes

Versions: 3

Compression:

Stored size: 583 Bytes

Contents

module Medie
  
  # This is a simple implementation of a media type that provides no links
  # and no marshalling, except the content itself. There is no parsing.
  class Generic

    # Because there is no media type registered
    # return the content itself
    def unmarshal(content)
      def content.links
        []
      end
      content
    end

    # Because there is no media type registered, return the string itself.
    def marshal(string, rel)
      string
    end
    
    def can_handle?(media_type)
      true
    end

  end

  Medie.registry << Generic.new
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
medie-1.0.0 lib/medie/generic.rb
medie-1.0.0.beta4 lib/medie/generic.rb
medie-1.0.0.beta3 lib/medie/generic.rb