Module: SmartIoC::Iocify

Defined in:
lib/smart_ioc/iocify.rb

Overview

Extend Object with bean declaration and bean injection functionality Example of usage: class Bar

bean :bar

def call
end

end

class Foo

include SmartIoC::Iocify
bean :foo, scope: :prototype, instance: false, factory_method: :get_beans

inject :bar
inject :some_bar, ref: bar, from: :repository

def hello_world
  some_bar.call
  puts 'Hello world'
end

end

SmartIoC::Container.get_bean(:bar).hello_world

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



25
26
27
# File 'lib/smart_ioc/iocify.rb', line 25

def self.included base
  base.extend ClassMethods
end