diff options
| author | Luke Kanies <luke@madstop.com> | 2005-04-18 22:54:43 +0000 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2005-04-18 22:54:43 +0000 |
| commit | a16493db1308e3d6b9b2c4e60ed5b9e5eda7d048 (patch) | |
| tree | 89f67025168f294c2c851eec5b6f7232ca78638c | |
| parent | 69a127644d4ba32376bfefb886523ec04fe8eab4 (diff) | |
type.rb: adding methods to simplify type initialization, and adding eachtype() to simplify testing
git-svn-id: https://reductivelabs.com/svn/puppet/library/trunk@188 980ebf18-57e1-0310-9a29-db15c13687c0
| -rw-r--r-- | lib/blink/type.rb | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/lib/blink/type.rb b/lib/blink/type.rb index 5a60ee83b..dc23161b8 100644 --- a/lib/blink/type.rb +++ b/lib/blink/type.rb @@ -79,13 +79,16 @@ module Blink #--------------------------------------------------------------- #--------------------------------------------------------------- + def Type.eachtype + @@typeary.each { |type| yield type } + end + #--------------------------------------------------------------- + + #--------------------------------------------------------------- # this should make it so our subclasses don't have to worry about # defining these class instance variables def Type.inherited(sub) - sub.module_eval %q{ - @objects = Hash.new - @actions = Hash.new - } + sub.initvars # add it to the master list # unfortunately we can't yet call sub.name, because the #inherited @@ -96,6 +99,15 @@ module Blink #--------------------------------------------------------------- #--------------------------------------------------------------- + # this is so we don't have to eval this code + # init all of our class instance variables + def Type.initvars + @objects = Hash.new + @actions = Hash.new + end + #--------------------------------------------------------------- + + #--------------------------------------------------------------- # this is used for mapping object types (e.g., Blink::Type::File) # to names (e.g., "file") def Type.name |
