Class: Gotenberg::Helper::LocalAsset

Inherits:
Object
  • Object
show all
Defined in:
lib/gotenberg/helper.rb

Overview

rubocop:disable Style/Documentation

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ LocalAsset

Returns a new instance of LocalAsset.



42
43
44
# File 'lib/gotenberg/helper.rb', line 42

def initialize(path)
  @path = path
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



40
41
42
# File 'lib/gotenberg/helper.rb', line 40

def path
  @path
end

Instance Method Details

#content_typeObject



46
47
48
# File 'lib/gotenberg/helper.rb', line 46

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

#filenameObject



54
55
56
# File 'lib/gotenberg/helper.rb', line 54

def filename
  path.to_s
end

#to_sObject



50
51
52
# File 'lib/gotenberg/helper.rb', line 50

def to_s
  File.read(path)
end