class Locomotive::Wagon::ContentAssetDecorator

Public Instance Methods

__attributes__() click to toggle source
# File lib/locomotive/wagon/decorators/content_asset_decorator.rb, line 8
def __attributes__
  %i(source)
end
checksum() click to toggle source
# File lib/locomotive/wagon/decorators/content_asset_decorator.rb, line 16
def checksum
  Digest::MD5.hexdigest(_readfile(filepath) { |io| io.read })
end
filename() click to toggle source
# File lib/locomotive/wagon/decorators/content_asset_decorator.rb, line 20
def filename
  File.basename(filepath)
end
source() click to toggle source
# File lib/locomotive/wagon/decorators/content_asset_decorator.rb, line 12
def source
  Locomotive::Coal::UploadIO.new(_readfile(filepath), nil, filename)
end

Private Instance Methods

_readfile(path, &block) click to toggle source
# File lib/locomotive/wagon/decorators/content_asset_decorator.rb, line 26
def _readfile(path, &block)
  File.open(path, 'rb', &block)
end