class Construqt::Resources
Public Class Methods
new(region)
click to toggle source
# File lib/construqt/resource.rb, line 41 def initialize(region) @region = region @files = {} end
Public Instance Methods
add_file(data, right, key, *path)
click to toggle source
# File lib/construqt/resource.rb, line 56 def add_file(data, right, key, *path) throw "need a key" unless key throw "need a path #{key}" if path.empty? throw "resource exists with key #{key}" if @files[key] resource = Resource.new resource.path = *path resource.right = right resource.data = data @files[key] = resource resource end
add_from_file(src_fname, right, key, *path)
click to toggle source
# File lib/construqt/resource.rb, line 46 def add_from_file(src_fname, right, key, *path) add_file(IO.read(src_fname), right, key, *path) end
add_skip_file(fname)
click to toggle source
# File lib/construqt/resource.rb, line 50 def add_skip_file(fname) sf = SkipFile.new sf.path = fname sf end
find(key)
click to toggle source
# File lib/construqt/resource.rb, line 68 def find(key) ret = @files[key] throw "resource with key #{key} not found" unless ret ret end