Module: VCR::Normalizers::Body

Included in:
Request, Response
Defined in:
lib/vcr/structs.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



10
11
12
# File 'lib/vcr/structs.rb', line 10

def self.included(klass)
  klass.extend ClassMethods
end

Instance Method Details

#initialize(*args) ⇒ Object



61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/vcr/structs.rb', line 61

def initialize(*args)
  super

  if body && !body.is_a?(String)
    raise ArgumentError, "#{self.class} initialized with an invalid body: #{body.inspect}."
  end

  # Ensure that the body is a raw string, in case the string instance
  # has been subclassed or extended with additional instance variables
  # or attributes, so that it is serialized to YAML as a raw string.
  # This is needed for rest-client.  See this ticket for more info:
  # http://github.com/myronmarston/vcr/issues/4
  self.body = String.new(body.to_s)
end