Method: Hx::Interop::ContentType#initialize

Defined in:
lib/interop/content_type.rb

#initialize(name, marshaler) ⇒ ContentType

Returns a new instance of ContentType.



11
12
13
14
15
16
17
18
19
20
# File 'lib/interop/content_type.rb', line 11

def initialize(name, marshaler)
  name.is_a? String or
    raise ArgumentError, 'Expected name to be a string'

  i[load dump].all?(&marshaler.method(:respond_to?)) or
    raise ArgumentError, 'Expected marshaler to respond to :load and :dump'

  @name = -name
  @marshaler = marshaler
end