Class: Seed
- Inherits:
-
Object
- Object
- Seed
- Defined in:
- lib/seed.rb
Overview
This class provides the seed part of the Gardener,Garden,Seed natural design patern
In nature, seed is usually small, and so is this class. No atributes/variables of itself, its only a kind of localized getter/setter class for the global $seed variable. Every garden row assess one fork-localized $seed variable, and you get access to it from a seed
instance passed to every Abundance.grow iteration.
- Author
-
lp ([email protected])
- Copyright
-
2008 Louis-Philippe Perron - Released under the terms of the MIT license
:title:Seed
Instance Method Summary collapse
-
#crop(success, message) ⇒ Object
The
crop
method for the Seed instance allow to set a success status and a return message from the inside the Abundance.grow block. -
#sprout ⇒ Object
The
sprout
method for the Seed instance allow to get the passed command from the inside the Abundance.grow block.
Instance Method Details
#crop(success, message) ⇒ Object
The crop
method for the Seed instance allow to set a success status and a return message from the inside the Abundance.grow block.
Parameter
-
success = success of the iteration, may be true or false
-
message = a ruby expression or object
Example
if success
seed.crop(true,results)
else
seed.crop(false,results)
end
37 38 39 |
# File 'lib/seed.rb', line 37 def crop(success,) $seed[:success] = success; $seed[:message] = end |
#sprout ⇒ Object
The sprout
method for the Seed instance allow to get the passed command from the inside the Abundance.grow block.
Example
system "#{seed.sprout}\n"
22 23 24 |
# File 'lib/seed.rb', line 22 def sprout return $seed[:seed] end |