Class: Dependency
Instance Attribute Summary collapse
-
#base ⇒ Object
Returns the value of attribute base.
-
#service ⇒ Object
Returns the value of attribute service.
Instance Method Summary collapse
-
#dependency! ⇒ Object
TODO: The dependency warning msg should be in service object.
-
#initialize(base, service:) ⇒ Dependency
constructor
A new instance of Dependency.
- #load! ⇒ Object
- #should_load? ⇒ Boolean
Constructor Details
#initialize(base, service:) ⇒ Dependency
Returns a new instance of Dependency.
4 5 6 7 |
# File 'lib/r_kit/core/loader/dependency.rb', line 4 def initialize base, service:; @base = base @service = RKit.const_get(service.to_s.classify) end |
Instance Attribute Details
#base ⇒ Object
Returns the value of attribute base.
2 3 4 |
# File 'lib/r_kit/core/loader/dependency.rb', line 2 def base @base end |
#service ⇒ Object
Returns the value of attribute service.
2 3 4 |
# File 'lib/r_kit/core/loader/dependency.rb', line 2 def service @service end |
Instance Method Details
#dependency! ⇒ Object
TODO: The dependency warning msg should be in service object
14 15 16 17 18 19 20 21 |
# File 'lib/r_kit/core/loader/dependency.rb', line 14 def dependency! warn %Q{ WARNING - #{ service.name } will be implicitly loaded, As a dependency for #{ base }. You may want to load it explicitly. } service.load end |
#load! ⇒ Object
23 24 25 |
# File 'lib/r_kit/core/loader/dependency.rb', line 23 def load! dependency! if should_load? end |
#should_load? ⇒ Boolean
9 10 11 |
# File 'lib/r_kit/core/loader/dependency.rb', line 9 def should_load? !service.loaded? end |