Project

bazza

0.0
No commit activity in last 3 years
No release in over 3 years
bazza - the builder
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

>= 0
 Project Readme

bazza - the builder Build Status

Build up objects close to where they're being used.

customer = Customer.with.Order.with(:total => 22.21).thats.active.build

You can:

  • specify defaults
    • can be overridden
  • reuse builders
  • chain builders
  • specialise builders

An Example

customer = Customer.with.Order.with(:total => 22.21).thats.active.build

class Customer end

class Order end

class CustomerBuilder end

class OrderBuilder end

License

Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 Unported License.

TODO

  • Association:
    • single
      • implement responds_to whereever method_missing implemented
      • ponder adding default hash param to #with
      • dynamically add the methods to builder, based on instance being built?
    • many
      • Build multiple: Customer.with.two.Orders
      • linguistics gem for text to number conversion
  • Specialisation
    • infer #make#{Something} method convention for specialisation methods on builder?
  • #initialize and #build should be already available to builder
  • #with and #thats can't be combined at present
  • Reusing builders
  • Replace String>>#to_class implementation from stack overflow article with a spec'd/tested version
  • Alternative syntax:
    • Order.thats.active.build => Build.order.thats.active
    • Advantage is Class extension no longer needed
    • How to know when to build the instance?