module SmartIoC::Iocify

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

Public Class Methods

included(base) click to toggle source
# File lib/smart_ioc/iocify.rb, line 25
def self.included base
  base.extend ClassMethods
end