Class: Party::Proxy::Factory

Inherits:
Object
  • Object
show all
Defined in:
lib/proxy_party.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(klass, create_method = nil) ⇒ Factory

Returns a new instance of Factory.



10
11
12
13
# File 'lib/proxy_party.rb', line 10

def initialize klass, create_method = nil
  @klass = klass
  @create_method = create_method
end

Instance Attribute Details

#create_methodObject (readonly)

Returns the value of attribute create_method.



8
9
10
# File 'lib/proxy_party.rb', line 8

def create_method
  @create_method
end

#klassObject (readonly)

Returns the value of attribute klass.



8
9
10
# File 'lib/proxy_party.rb', line 8

def klass
  @klass
end

Instance Method Details

#createObject



15
16
17
# File 'lib/proxy_party.rb', line 15

def create
  create_method ? klass.send(create_method) : klass.new
end