class Gluey::Workshop
Attributes
cache[R]
cache_path[R]
materials[R]
Public Class Methods
new(root, cache_path='tmp/gluey', **opts, &block)
click to toggle source
Calls superclass method
Gluey::Environment::new
# File lib/gluey/workshop.rb, line 12 def initialize(root, cache_path='tmp/gluey', **opts, &block) super opts.merge!( root: root, cache_path: "#{root}/#{cache_path}", materials: {}, cache: {} ), &block FileUtils.mkdir_p @cache_path end
Public Instance Methods
get_binding()
click to toggle source
# File lib/gluey/workshop.rb, line 35 def get_binding binding end
material(name)
click to toggle source
# File lib/gluey/workshop.rb, line 22 def material(name) @materials[name.to_sym] || raise(UnregisteredMaterial.new "Unknown material #{name}.") end
register_material(name, glue=::Gluey::Glues::Base, &block)
click to toggle source
# File lib/gluey/workshop.rb, line 26 def register_material(name, glue=::Gluey::Glues::Base, &block) name = name.to_sym raise "Material #{name} already registered!" if @materials[name] material = ::Gluey::Material.new name, glue, self, &block material.items << :any if material.items.empty? @materials[name] = material end