Module: LSystem
- Extended by:
- Loggability
- Defined in:
- lib/l_system.rb
Overview
A toolkit for creating and using Lindenmayer Systems.
Defined Under Namespace
Classes: ProductionAdapter, RulesEngine
Constant Summary collapse
- VERSION =
Package version
'0.1.0'
- REVISION =
Version control revision
%q$Revision$
Class Method Summary collapse
-
.declare(&block) ⇒ Object
Declare a new L-System that is configured via the given
block
. -
.run(rules_engine, iterations = 1000, &block) ⇒ Object
Run a
rules_engine
at most the given number ofiterations
using the productions declared in theblock
, which runs in the context of an anonymous LSystem::ProductionAdapter class.
Class Method Details
.declare(&block) ⇒ Object
Declare a new L-System that is configured via the given block
.
27 28 29 |
# File 'lib/l_system.rb', line 27 def self::declare( &block ) return LSystem::RulesEngine.new( &block ) end |
.run(rules_engine, iterations = 1000, &block) ⇒ Object
Run a rules_engine
at most the given number of iterations
using the productions declared in the block
, which runs in the context of an anonymous LSystem::ProductionAdapter class.
35 36 37 38 39 40 |
# File 'lib/l_system.rb', line 35 def self::run( rules_engine, iterations=1000, &block ) raise LocalJumpError, "no block given" unless block adapter = Class.new( LSystem::ProductionAdapter, &block ) return adapter.new.run( rules_engine, iterations ) end |