Module: TrailerVote::Api::HtmlTypeAdapter

Defined in:
lib/trailer_vote/api/fallback_content_types.rb

Class Method Summary collapse

Class Method Details

.decode(str) ⇒ Object



43
44
45
# File 'lib/trailer_vote/api/fallback_content_types.rb', line 43

def decode(str)
  str
end

.encode(obj) ⇒ Object

Raises:



35
36
37
38
39
40
41
# File 'lib/trailer_vote/api/fallback_content_types.rb', line 35

def encode(obj)
  return obj if obj.is_a?(String)
  raise EncodeError.new(
    media_type: 'text/html',
    source: ArgumentError.new('HTML must be passed in as a HTML string')
  )
end