class Gluey::Environment

Attributes

base_url[R]
mark_versions[RW]
path_prefix[R]
root[R]

Public Class Methods

new(**opts, &block) click to toggle source
# File lib/gluey/base/environment.rb, line 8
def initialize(**opts, &block)
  opts = {
      base_url: nil,
      path_prefix: '/assets'
  }.merge! opts

  opts.each do |k, value|
    next unless k.is_a? Symbol
    instance_variable_set "@#{k}", value
  end
  instance_exec &block if block

  root || raise('Root directory not defined!')
end

Public Instance Methods

[](material, path, mark=nil) click to toggle source
# File lib/gluey/base/environment.rb, line 27
def [](material, path, mark=nil)
  fetch(material, path, mark)[0]
end
Also aliased as: find_asset_file
asset_url(material, path) click to toggle source
# File lib/gluey/base/environment.rb, line 23
def asset_url(material, path)
  "#{base_url}#{path_prefix}/#{material}/#{real_path material, path}"
end
find_asset_file(material, path, mark=nil)
Alias for: []