Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Support vendor media types

  • Loading branch information...
commit e3ee39f1b81efd9cac483efc8e059d322d882844 1 parent 7a75fab
Kunal Shah authored
View
8 lib/hypertemplate/builder/base.rb
@@ -7,6 +7,14 @@ class Base
class << self
+ def media_types
+ @media_types
+ end
+
+ def extend_media_types(media_types)
+ @media_types.push(*media_types)
+ end
+
def build_dsl(obj, options = {}, &block)
recipe = block_given? ? block : options.delete(:recipe)
raise Hypertemplate::BuilderError.new("Recipe required to build representation.") unless recipe.respond_to?(:call)
View
4 lib/hypertemplate/builder/json.rb
@@ -2,9 +2,7 @@ module Hypertemplate
module Builder
class Json < Hypertemplate::Builder::Base
- def self.media_types
- ["application/json"]
- end
+ @media_types = ["application/json"]
attr_reader :raw
View
4 lib/hypertemplate/builder/xml.rb
@@ -2,9 +2,7 @@ module Hypertemplate
module Builder
class Xml < Hypertemplate::Builder::Base
- def self.media_types
- ["application/xml", "text/xml"]
- end
+ @media_types = ["application/xml", "text/xml"]
attr_reader :raw
Please sign in to comment.
Something went wrong with that request. Please try again.