Advertisement
saasbook

factory_pattern_pitfall.rb

Jan 10th, 2012
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.14 KB | None | 0 0
  1. class A
  2.   def self.create(subclass, *args) # subclass must be either 'A1' or 'A2'
  3.     return Object.const_get(subclass).send(:new, *args)
  4.   end
  5. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement