Sha256: 6d316815d1081c103359b67f7382fd83fdd1f328701a7fddbb40556f94320c31
Contents?: true
Size: 722 Bytes
Versions: 28
Compression:
Stored size: 722 Bytes
Contents
require "uber/builder" module Disposable class Twin # Allows building different twin classes. # # class SongTwin < Disposable::Twin # include Builder # builds ->(model, options) do # return Hit if model.is_a? Model::Hit # return Evergreen if options[:evergreen] # end # end # # SongTwin.build(Model::Hit.new) #=> <Hit> module Builder def self.included(base) base.class_eval do include Uber::Builder def self.build(model, options={}) # semi-public. class_builder.call(model, options).new(model, options) # Uber::Builder::class_builder. end end end end end end
Version data entries
28 entries across 28 versions & 1 rubygems