lib/deas/runner.rb in deas-0.40.0 vs lib/deas/runner.rb in deas-0.41.0

- old
+ new

@@ -50,15 +50,12 @@ @headers end def body(value = nil) if !value.nil? - unless value.respond_to?(:each) - raise ArgumentError, "this body value (class `#{value.class}`), does not "\ - "respond to `each`." - end - @body = value + # String#each is a thing in 1.8.7, so account for it here + @body = !value.respond_to?(:each) || value.kind_of?(String) ? [*value] : value end @body end def content_type(extname, params = nil) @@ -66,10 +63,10 @@ end def halt(*args) self.status(args.shift) if args.first.instance_of?(::Fixnum) self.headers(args.shift) if args.first.kind_of?(::Hash) - self.body(args.shift) if args.first.respond_to?(:each) + self.body(args.shift) throw :halt end def redirect(location, *halt_args) self.status(302)