class Rack::Tipi::Asset
Attributes
namespace[R]
path[R]
Public Class Methods
new(namespace, path, route)
click to toggle source
# File lib/rack/tipi/asset.rb, line 8 def initialize(namespace, path, route) @namespace = namespace @path = Pathname.new(path).expand_path @route = route.sub(/\//, '') end
Public Instance Methods
==(other)
click to toggle source
# File lib/rack/tipi/asset.rb, line 14 def ==(other) route == other.route if other.respond_to? :route end
content()
click to toggle source
# File lib/rack/tipi/asset.rb, line 18 def content path.read end
mime_type()
click to toggle source
# File lib/rack/tipi/asset.rb, line 22 def mime_type Rack::Mime.mime_type(path.extname) end
route()
click to toggle source
# File lib/rack/tipi/asset.rb, line 26 def route "/#{namespace}/#{@route}" end