mirror of
https://github.com/ms-ati/docile
synced 2023-03-27 23:21:52 -04:00
Update README.md
Without returning `self` this example fail.
This commit is contained in:
parent
f0f1c5f2cc
commit
3384ac962e
1 changed files with 4 additions and 4 deletions
|
@ -66,10 +66,10 @@ And let's say we have a PizzaBuilder, which builds a Pizza like this:
|
||||||
Pizza = Struct.new(:cheese, :pepperoni, :bacon, :sauce)
|
Pizza = Struct.new(:cheese, :pepperoni, :bacon, :sauce)
|
||||||
|
|
||||||
class PizzaBuilder
|
class PizzaBuilder
|
||||||
def cheese(v=true); @cheese = v; end
|
def cheese(v=true); @cheese = v; self; end
|
||||||
def pepperoni(v=true); @pepperoni = v; end
|
def pepperoni(v=true); @pepperoni = v; self; end
|
||||||
def bacon(v=true); @bacon = v; end
|
def bacon(v=true); @bacon = v; self; end
|
||||||
def sauce(v=nil); @sauce = v; end
|
def sauce(v=nil); @sauce = v; self; end
|
||||||
def build
|
def build
|
||||||
Pizza.new(!!@cheese, !!@pepperoni, !!@bacon, @sauce)
|
Pizza.new(!!@cheese, !!@pepperoni, !!@bacon, @sauce)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue