Sha256: ef765c2e4f5960143d2a9d2e2a81f6642831a3975524a87f149ebaae70a60c15
Contents?: true
Size: 731 Bytes
Versions: 3
Compression:
Stored size: 731 Bytes
Contents
require 'rgen/find_helper' module RGen # An Environment is used to hold model elements. # class Environment include RGen::FindHelper def initialize @elements = [] end # Add a model element. Returns the environment so <code><<</code> can be chained. # def <<(el) @elements << el self end # Iterates each element # def each(&b) @elements.each(&b) end # Return the elements of the environment as an array # def elements @elements.dup end # This method can be used to instantiate a class and automatically put it into # the environment. The new instance is returned. # def new(clazz, *args) @elements << clazz.new(*args) @elements[-1] end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rgen-0.4.1 | lib/rgen/environment.rb.bak |
rgen-0.4.2 | lib/rgen/environment.rb.bak |
rgen-0.4.0 | lib/rgen/environment.rb |