Class: WickedPdf::WickedPdfHelper::Assets::LocalAsset

Inherits:
Object
  • Object
show all
Defined in:
lib/wicked_pdf/wicked_pdf_helper/assets.rb

Direct Known Subclasses

PropshaftAsset

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ LocalAsset

Returns a new instance of LocalAsset.



46
47
48
# File 'lib/wicked_pdf/wicked_pdf_helper/assets.rb', line 46

def initialize(path)
  @path = path
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



44
45
46
# File 'lib/wicked_pdf/wicked_pdf_helper/assets.rb', line 44

def path
  @path
end

Instance Method Details

#content_typeObject



50
51
52
# File 'lib/wicked_pdf/wicked_pdf_helper/assets.rb', line 50

def content_type
  Mime::Type.lookup_by_extension(File.extname(path).delete('.'))
end

#filenameObject



58
59
60
# File 'lib/wicked_pdf/wicked_pdf_helper/assets.rb', line 58

def filename
  path.to_s
end

#to_sObject



54
55
56
# File 'lib/wicked_pdf/wicked_pdf_helper/assets.rb', line 54

def to_s
  IO.read(path)
end