Module: Capncook

Defined in:
lib/capncook.rb

Class Method Summary collapse

Class Method Details

.build(klass) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/capncook.rb', line 4

def self.build(klass)
  klass_name = klass.to_s.capitalize
  user = Object.const_get(klass_name).new
  user.first_name = "Walter"

  return user
rescue NameError => error
  raise Exception.new("'#{klass.to_s.capitalize}' is an unknown class.")
end