Sha256: 6d8a100fd8fedcb19ceefcf17e982ac9c99d1191020b25076aee7e7ee9398192
Contents?: true
Size: 826 Bytes
Versions: 1
Compression:
Stored size: 826 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 # Removes model element from environment. def delete(el) @elements.delete(el) 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rgen-0.4.1 | lib/rgen/environment.rb |