summaryrefslogtreecommitdiffstats
path: root/state.rb
diff options
context:
space:
mode:
authorCasey Dahlin <cdahlin@redhat.com>2008-10-10 10:33:58 -0400
committerCasey Dahlin <cdahlin@redhat.com>2008-10-10 10:33:58 -0400
commit3b01624e797184fc0e79fbf463bfdd4c3554f8cd (patch)
tree21feb9f9c5e1093a3d82e62d1a42142290d96e4e /state.rb
parent50415bdba2b379a9b320f05456cb0b4c9c363cef (diff)
downloadupstate-3b01624e797184fc0e79fbf463bfdd4c3554f8cd.tar.gz
upstate-3b01624e797184fc0e79fbf463bfdd4c3554f8cd.tar.xz
upstate-3b01624e797184fc0e79fbf463bfdd4c3554f8cd.zip
Add State::get_all method
State::get_all gets all states. When the receiver is a subclass of State it returns all states of that type.
Diffstat (limited to 'state.rb')
-rw-r--r--state.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/state.rb b/state.rb
index b1f7de0..d8f6458 100644
--- a/state.rb
+++ b/state.rb
@@ -276,6 +276,11 @@ class State
nil
end
+ # Get all states of this type
+ def State.get_all
+ @@states.select{ |x| x.is_a? self }
+ end
+
# Depsolve all state classes. This method is not defined in subclasses of
# State.
def State.depsolve_all