Module: Capcode::Helpers

Defined in:
lib/capcode/render/binary.rb

Instance Method Summary collapse

Instance Method Details

#render_binary(f, opts) ⇒ Object

:nodoc:



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/capcode/render/binary.rb', line 3

def render_binary( f, opts ) #:nodoc:
  @response['Content-Type'] = opts.delete(:content_type)||opts.delete('Content-Type')||"binary/octet-stream"
  opts.each do |k, v|
    k = k.to_s.split(/_/).map{|e| e.capitalize}.join("-")
    @response[k] = v
  end
  
  if self.respond_to?(f.to_sym)
    self.send(f) 
  else
    f
  end
end