Module: SmartIoC
- Extended by:
- Forwardable
- Defined in:
- lib/smart_ioc.rb,
lib/smart_ioc/version.rb,
lib/smart_ioc/container.rb,
lib/smart_ioc/string_utils.rb
Defined Under Namespace
Modules: Args, Errors, Iocify, Scopes Classes: BeanDefinition, BeanDefinitionsStorage, BeanDependency, BeanFactory, BeanFileLoader, BeanLocations, BeanLocator, Container, ExtraPackageContexts, InjectMetadata, Railtie, StringUtils
Constant Summary collapse
- VERSION =
"0.5.2"
Class Method Summary collapse
- .benchmark_mode(flag) ⇒ Object
-
.clear ⇒ Object
Full clear of data (mostly for tests).
- .container ⇒ Object
-
.find_package_beans(package_name, dir) ⇒ Object
Nil.
- .is_benchmark_mode ⇒ Object
-
.load_all_beans ⇒ Object
Load all beans (usually required for production env).
Class Method Details
.benchmark_mode(flag) ⇒ Object
57 58 59 |
# File 'lib/smart_ioc.rb', line 57 def benchmark_mode(flag) @benchmark_mode = !!flag end |
.clear ⇒ Object
Full clear of data (mostly for tests)
69 70 71 72 |
# File 'lib/smart_ioc.rb', line 69 def clear BeanLocations.clear Container.clear end |
.container ⇒ Object
74 75 76 |
# File 'lib/smart_ioc.rb', line 74 def container Container.get_instance end |
.find_package_beans(package_name, dir) ⇒ Object
Returns nil.
42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/smart_ioc.rb', line 42 def find_package_beans(package_name, dir) time = Benchmark.realtime do bean_locator = SmartIoC::BeanLocator.new bean_locator.locate_beans(package_name.to_sym, dir) end time *= 1000 if is_benchmark_mode puts "Search finished for '#{package_name}'. Time taken: #{"%.2f ms" % time}" end nil end |
.is_benchmark_mode ⇒ Object
35 36 37 |
# File 'lib/smart_ioc.rb', line 35 def is_benchmark_mode @benchmark_mode end |
.load_all_beans ⇒ Object
Load all beans (usually required for production env)
62 63 64 65 66 |
# File 'lib/smart_ioc.rb', line 62 def load_all_beans BeanLocations.all_bean_names.each do |bean| container.require_bean(bean) end end |