class Hanami::Assets::Bundler::Asset

@since 0.3.0 @api private

Constants

WILDCARD_EXT

@since 0.3.0 @api private

Attributes

configuration[R]

@since 0.3.0 @api private

path[R]

@since 0.3.0 @api private

Public Class Methods

new(path, configuration) click to toggle source

Return a new instance

@since 0.3.0 @api private

# File lib/hanami/assets/bundler/asset.rb, line 31
def initialize(path, configuration)
  @path = path
  @configuration = configuration
end

Public Instance Methods

base64_digest(algorithm) click to toggle source

@since 0.3.0 @api private

# File lib/hanami/assets/bundler/asset.rb, line 56
def base64_digest(algorithm)
  raw_digest(algorithm).base64digest
end
expanded_fingerprinted_target() click to toggle source

@since 0.3.0 @api private

# File lib/hanami/assets/bundler/asset.rb, line 50
def expanded_fingerprinted_target
  ::File.expand_path(fingerprinted_target)
end
expanded_path() click to toggle source

@since 0.3.0 @api private

# File lib/hanami/assets/bundler/asset.rb, line 38
def expanded_path
  ::File.expand_path(@path)
end
fingerprinted_target() click to toggle source

@since 0.3.0 @api private

# File lib/hanami/assets/bundler/asset.rb, line 44
def fingerprinted_target
  ::File.join(directory, "#{filename}-#{fingerprint}#{extension}")
end

Private Instance Methods

contents() click to toggle source

@since 0.3.0 @api private

# File lib/hanami/assets/bundler/asset.rb, line 94
def contents
  ::File.read(@path)
end
directory() click to toggle source

@since 0.3.0 @api private

# File lib/hanami/assets/bundler/asset.rb, line 64
def directory
  ::File.dirname(@path)
end
extension() click to toggle source

@since 0.3.0 @api private

# File lib/hanami/assets/bundler/asset.rb, line 76
def extension
  ::File.extname(@path)
end
filename() click to toggle source

@since 0.3.0 @api private

# File lib/hanami/assets/bundler/asset.rb, line 70
def filename
  ::File.basename(@path, WILDCARD_EXT)
end
fingerprint() click to toggle source

@since 0.3.0 @api private

# File lib/hanami/assets/bundler/asset.rb, line 82
def fingerprint
  raw_digest(:md5).hexdigest
end
raw_digest(algorithm) click to toggle source

@since 0.3.0 @api private

# File lib/hanami/assets/bundler/asset.rb, line 88
def raw_digest(algorithm)
  OpenSSL::Digest.new(algorithm.to_s, contents)
end