class CabezaDeTermo::AssetsPublisher::Location

Public Class Methods

class_for_uri(uri) click to toggle source

Answer the class to use for the uri

# File lib/cabeza-de-termo/assets-publisher/locations/location.rb, line 12
def self.class_for_uri(uri)
        uri = Pathname.new(uri)

        return class_named("CabezaDeTermo::AssetsPublisher::AbsoluteLocation") if uri.absolute?
        return class_named("CabezaDeTermo::AssetsPublisher::SourceLocation") if uri.relative?

        raise UnknownAssetLocationError.new(uri)
end
class_named(fully_qualified) click to toggle source

Answer a class from its fully quilified name

# File lib/cabeza-de-termo/assets-publisher/locations/location.rb, line 22
def self.class_named(fully_qualified)
        fully_qualified.split('::').inject(Object) do |mod, class_name|
                mod.const_get(class_name)
        end
end
from(uri) click to toggle source

Answer a new location for the uri

# File lib/cabeza-de-termo/assets-publisher/locations/location.rb, line 7
def self.from(uri)
        class_for_uri(uri).new(uri)
end
new(uri) click to toggle source

Instance methods

# File lib/cabeza-de-termo/assets-publisher/locations/location.rb, line 30
def initialize(uri)
        @uri = uri
end

Public Instance Methods

configuration() click to toggle source

Answer the Publisher configuration.

# File lib/cabeza-de-termo/assets-publisher/locations/location.rb, line 35
def configuration
        Publisher.configuration
end
is_absolute?() click to toggle source

Asking

# File lib/cabeza-de-termo/assets-publisher/locations/location.rb, line 41
def is_absolute?()
        false
end
real_path_of(uri) click to toggle source

Answer the path of the asset uri

# File lib/cabeza-de-termo/assets-publisher/locations/location.rb, line 46
def real_path_of(uri)
        CdT.subclass_responsibility
end