Module: Nina::ClassMethods

Defined in:
lib/nina.rb

Overview

Definaes support methods and variables

Instance Method Summary collapse

Instance Method Details

#builder(name, &block) ⇒ Object



22
23
24
25
# File 'lib/nina.rb', line 22

def builder(name, &block)
  builders[name] = Nina::Builder.new(name, abstract_factory: Class.new, &block)
  define_singleton_method(:"#{name}_builder") { builders[name] }
end

#buildersObject



14
15
16
# File 'lib/nina.rb', line 14

def builders
  @builders ||= {}
end

#builders=(other) ⇒ Object



18
19
20
# File 'lib/nina.rb', line 18

def builders=(other)
  @builders = other
end

#inherited(subclass) ⇒ Object



27
28
29
30
# File 'lib/nina.rb', line 27

def inherited(subclass)
  super
  subclass.builders = builders.transform_values(&:copy)
end