Class: Crayfish::Rails::PDF
- Inherits:
-
Object
- Object
- Crayfish::Rails::PDF
- Defined in:
- lib/crayfish/rails/pdf.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(controller) ⇒ PDF
constructor
A new instance of PDF.
Constructor Details
#initialize(controller) ⇒ PDF
Returns a new instance of PDF.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/crayfish/rails/pdf.rb', line 30 def initialize(controller) = controller ? controller.send(:options) || {} : {} @options = Crayfish::ActionController..merge(Hash[*.map{ |k,v| [k.to_sym,v] }.flatten]) if controller if [:html] controller.response.content_type ||= Mime::HTML else controller.response.content_type ||= Mime::PDF end end inline = [:inline] ? 'inline' : 'attachment' filename = [:filename] ? "filename=#{[:filename]}" : nil controller.headers["Content-Disposition"] = [inline,filename].compact.join(';') if controller end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
28 29 30 |
# File 'lib/crayfish/rails/pdf.rb', line 28 def @options end |