22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/trax/core/has_dependencies.rb', line 22
def initialize(*args, **options)
if self.class._depends_on.length
missing_dependencies = self.class._depends_on.select{|k| !options.key?(k) }
if missing_dependencies.any?
raise ::Trax::Core::Errors::MissingRequiredDependency.new(:source => self.class, :missing_dependencies => missing_dependencies)
else
options.(*self._depends_on).each_pair do |k,v|
instance_variable_set("@#{k}", v)
end
end
end
if self.class._depends_on_config[:pass_options_to_super]
super(*args, **options)
else
super(*args)
end
end
|