Sha256: 53b071d72cbfa0b840a9506e7fde5cc584088716082ac9690c78da0f3b4dc6c7
Contents?: true
Size: 772 Bytes
Versions: 3
Compression:
Stored size: 772 Bytes
Contents
# frozen_string_literal: true require 'toritori' require 'nina/assembler' require 'nina/builder' require_relative 'nina/version' # Module that provides DSL for builders module Nina class Error < StandardError; end # Definaes support methods and variables module ClassMethods def builders @builders ||= {} end def builders=(other) @builders = other end def builder(name, &block) builders[name] = Nina::Builder.new(name, abstract_factory: Class.new, &block) define_singleton_method(:"#{name}_builder") { builders[name] } end def inherited(subclass) super subclass.builders = builders.transform_values(&:copy) end end def self.included(receiver) receiver.extend ClassMethods end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
nina-0.1.2 | lib/nina.rb |
nina-0.1.1 | lib/nina.rb |
nina-0.1.0 | lib/nina.rb |