Class: WickedPdf::WickedPdfHelper::Assets::LocalAsset
- Inherits:
-
Object
- Object
- WickedPdf::WickedPdfHelper::Assets::LocalAsset
- Defined in:
- lib/wicked_pdf/wicked_pdf_helper/assets.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #content_type ⇒ Object
- #filename ⇒ Object
-
#initialize(path) ⇒ LocalAsset
constructor
A new instance of LocalAsset.
- #to_s ⇒ Object
Constructor Details
#initialize(path) ⇒ LocalAsset
Returns a new instance of LocalAsset.
58 59 60 |
# File 'lib/wicked_pdf/wicked_pdf_helper/assets.rb', line 58 def initialize(path) @path = path end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
56 57 58 |
# File 'lib/wicked_pdf/wicked_pdf_helper/assets.rb', line 56 def path @path end |
Instance Method Details
#content_type ⇒ Object
62 63 64 |
# File 'lib/wicked_pdf/wicked_pdf_helper/assets.rb', line 62 def content_type Mime::Type.lookup_by_extension(File.extname(path).delete('.')) end |
#filename ⇒ Object
70 71 72 |
# File 'lib/wicked_pdf/wicked_pdf_helper/assets.rb', line 70 def filename path.to_s end |
#to_s ⇒ Object
66 67 68 |
# File 'lib/wicked_pdf/wicked_pdf_helper/assets.rb', line 66 def to_s IO.read(path) end |