Sha256: 85823f6727254b85b5476fbbb4dc14234211d21a5680d9f5e331356b67b202d8

Contents?: true

Size: 679 Bytes

Versions: 1

Compression:

Stored size: 679 Bytes

Contents

module Wee

  class ExternalResource
    def initialize(mount_path=nil)
      @mount_path = mount_path || "/" + self.class.name.to_s.downcase.gsub("::", "_")
    end

    def install(builder)
      rd = resource_dir()
      builder.map(@mount_path) do
        run Rack::File.new(rd)
      end
    end

    def javascripts
      []
    end

    def stylesheets
      []
    end

    protected

    def resource_dir
      raise
    end

    def file_relative(_file, *subdirs)
      File.expand_path(File.join(File.dirname(_file), *subdirs))
    end

    def mount_path_relative(*paths)
      paths.map {|path| "#{@mount_path}/#{path}"}
    end

  end # class ExternalResource

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mullen-wee-2.2.0 lib/wee/external_resource.rb