Class: RKit::Core::Loader::Dependency

Inherits:
String
  • Object
show all
Defined in:
lib/r_kit/core/loader.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(base, str: "") ⇒ Dependency

Returns a new instance of Dependency.



108
109
110
111
112
# File 'lib/r_kit/core/loader.rb', line 108

def initialize base, str: ""
  @_base = base

  super str.to_s
end

Instance Attribute Details

#_baseObject

Returns the value of attribute _base.



106
107
108
# File 'lib/r_kit/core/loader.rb', line 106

def _base
  @_base
end

Instance Method Details

#dependency!Object



118
119
120
121
122
123
124
125
# File 'lib/r_kit/core/loader.rb', line 118

def dependency!
  warn %Q{
WARNING - RKit::#{ classify } was implicitly loaded,
  As a dependency for #{ _base }.
  You may want to load it explicitly.
  }
  RKit.const_get(classify).load
end

#load!Object



127
128
129
# File 'lib/r_kit/core/loader.rb', line 127

def load!
  dependency! if should_load?
end

#should_load?Boolean

Returns:

  • (Boolean)


114
115
116
# File 'lib/r_kit/core/loader.rb', line 114

def should_load?
  !RKit::Core::Loader.class_variable_get(:@@loaded).include? self
end