Class: RKit::Core::Loader::Dependency
- Inherits:
-
Object
- Object
- RKit::Core::Loader::Dependency
- Defined in:
- lib/r_kit/core/loader.rb
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
-
#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.
117 118 119 120 |
# File 'lib/r_kit/core/loader.rb', line 117 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.
115 116 117 |
# File 'lib/r_kit/core/loader.rb', line 115 def base @base end |
#service ⇒ Object
Returns the value of attribute service.
115 116 117 |
# File 'lib/r_kit/core/loader.rb', line 115 def service @service end |
Instance Method Details
#dependency! ⇒ Object
126 127 128 129 130 131 132 133 |
# File 'lib/r_kit/core/loader.rb', line 126 def dependency! warn %Q{ WARNING - #{ @service.name } was implicitly loaded, As a dependency for #{ base }. You may want to load it explicitly. } @service.load end |
#load! ⇒ Object
135 136 137 |
# File 'lib/r_kit/core/loader.rb', line 135 def load! dependency! if should_load? end |
#should_load? ⇒ Boolean
122 123 124 |
# File 'lib/r_kit/core/loader.rb', line 122 def should_load? !RKit::Core::Loader.class_variable_get(:@@loaded).include? @service.name end |