Class: Locomotive::Wagon::ContentAssetDecorator
- Inherits:
-
Struct
- Object
- Struct
- Locomotive::Wagon::ContentAssetDecorator
show all
- Includes:
- ToHashConcern
- Defined in:
- lib/locomotive/wagon/decorators/content_asset_decorator.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
#prepare_value_for_hash, #to_hash
Instance Attribute Details
#filepath ⇒ Object
Returns the value of attribute filepath
4
5
6
|
# File 'lib/locomotive/wagon/decorators/content_asset_decorator.rb', line 4
def filepath
@filepath
end
|
Instance Method Details
#__attributes__ ⇒ Object
8
9
10
|
# File 'lib/locomotive/wagon/decorators/content_asset_decorator.rb', line 8
def __attributes__
%i(source)
end
|
#checksum ⇒ Object
16
17
18
|
# File 'lib/locomotive/wagon/decorators/content_asset_decorator.rb', line 16
def checksum
Digest::MD5.hexdigest(_readfile(filepath) { |io| io.read })
end
|
#filename ⇒ Object
20
21
22
|
# File 'lib/locomotive/wagon/decorators/content_asset_decorator.rb', line 20
def filename
File.basename(filepath)
end
|
#source ⇒ Object
12
13
14
|
# File 'lib/locomotive/wagon/decorators/content_asset_decorator.rb', line 12
def source
Locomotive::Coal::UploadIO.new(_readfile(filepath), nil, filename)
end
|