Module: ShirinjiRails::ResolverBinding::ClassMethods

Defined in:
lib/shirinji-rails/resolver_binding.rb

Instance Method Summary collapse

Instance Method Details

#_define_dependency_reader(bean, method = bean) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/shirinji-rails/resolver_binding.rb', line 10

def _define_dependency_reader(bean, method = bean)
  if bean.is_a?(Hash)
    return bean.each { |k,v| _define_dependency_reader(k, v) }
  end

  define_method(method) do
    resolver.resolve(bean)
  end
end

#dependency(*deps) ⇒ Object



6
7
8
# File 'lib/shirinji-rails/resolver_binding.rb', line 6

def dependency(*deps)
  deps.each { |dep| _define_dependency_reader(dep) }
end