Class: IocRb::Scopes::PrototypeScope

Inherits:
Object
  • Object
show all
Defined in:
lib/ioc_rb/scopes/prototype_scope.rb

Overview

Prototype scope instantiates new bean instance on each get_bean call

Instance Method Summary collapse

Constructor Details

#initialize(bean_factory) ⇒ PrototypeScope

Constructon

Parameters:

  • bean_factory

    bean factory



7
8
9
# File 'lib/ioc_rb/scopes/prototype_scope.rb', line 7

def initialize(bean_factory)
  @bean_factory = bean_factory
end

Instance Method Details

#delete_bean(bean_metadata) ⇒ Object

Delete bean from scope, because Prototype scope doesn’t store bean then do nothing here

Parameters:



23
24
# File 'lib/ioc_rb/scopes/prototype_scope.rb', line 23

def delete_bean()
end

#get_bean(bean_metadata) ⇒ Object

Get new bean instance

Parameters:



14
15
16
# File 'lib/ioc_rb/scopes/prototype_scope.rb', line 14

def get_bean()
  @bean_factory.create_bean_and_save(, {})
end