Module: NewClass::ClassMethods
- Defined in:
- lib/new_class.rb
Defined Under Namespace
Modules: Concerns, MethodMissing
Instance Method Summary collapse
Instance Method Details
#new_class(variables = {}, name = nil) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/new_class.rb', line 12 def new_class(variables = {}, name = nil) Class.new(self).tap do |klass| klass.send :include, Concerns, MethodMissing klass.extend MethodMissing klass._name = name || self.name klass._variables = variables.inject({}){|h, (k, v)| h.merge k.to_sym => v} klass.defined if klass.respond_to?(:defined) end end |