Class: Ree::Container
Constant Summary collapse
- MOUNT_AS =
[:fn, :object]
Instance Attribute Summary collapse
-
#packages_facade ⇒ Object
readonly
Returns the value of attribute packages_facade.
Class Method Summary collapse
-
.instance ⇒ Object
singleton.
Instance Method Summary collapse
- #compile(package, object_name) ⇒ Object
- #compile_object(name_with_package) ⇒ Ree::Object
-
#initialize ⇒ Container
constructor
A new instance of Container.
- #load_package(package_name) ⇒ Ree::Package
Methods included from Args
#check_arg, #check_arg_any, #check_arg_array_of, #check_bool, #not_nil
Constructor Details
#initialize ⇒ Container
Returns a new instance of Container.
28 29 30 31 |
# File 'lib/ree/container.rb', line 28 def initialize @packages_facade = Ree::PackagesFacade.new @object_compiler = Ree::ObjectCompiler.new(@packages_facade) end |
Instance Attribute Details
#packages_facade ⇒ Object (readonly)
Returns the value of attribute packages_facade.
26 27 28 |
# File 'lib/ree/container.rb', line 26 def packages_facade @packages_facade end |
Class Method Details
.instance ⇒ Object
singleton
11 12 13 14 15 16 17 18 19 |
# File 'lib/ree/container.rb', line 11 def instance SEMAPHORE.synchronize do @instance ||= begin self.new end end @instance end |
Instance Method Details
#compile(package, object_name) ⇒ Object
35 36 37 |
# File 'lib/ree/container.rb', line 35 def compile(package, object_name) compile_object("#{package.name}/#{object_name}") end |
#compile_object(name_with_package) ⇒ Ree::Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/ree/container.rb', line 41 def compile_object(name_with_package) check_arg(name_with_package, :name_with_package, String) list = name_with_package.to_s.split('/') name = nil package_name = nil if list.size == 2 package_name = list.first.to_sym name = list.last.to_sym else raise Ree::Error.new("'package/name' definition should be used to load object", :invalid_dsl_usage) end @packages_facade.get_loaded_package(package_name) @packages_facade.load_package_object(package_name, name) @object_compiler.call(package_name, name) end |
#load_package(package_name) ⇒ Ree::Package
64 65 66 |
# File 'lib/ree/container.rb', line 64 def load_package(package_name) @packages_facade.load_entire_package(package_name) end |