diff options
author | Casey Dahlin <cdahlin@redhat.com> | 2008-10-03 17:47:10 -0400 |
---|---|---|
committer | Casey Dahlin <cdahlin@redhat.com> | 2008-10-03 17:47:10 -0400 |
commit | fd3735a1f6b6ccdfde1856116e001c3c3b863f4f (patch) | |
tree | edfbbd78f71f72e85d54ec1d00089dd8bbe56896 /state.rb | |
parent | dc1cc9c4078603c89ec91432d12433d65fecc8eb (diff) | |
download | upstate-fd3735a1f6b6ccdfde1856116e001c3c3b863f4f.tar.gz upstate-fd3735a1f6b6ccdfde1856116e001c3c3b863f4f.tar.xz upstate-fd3735a1f6b6ccdfde1856116e001c3c3b863f4f.zip |
Add initial values to inject calls
Injecting with no prepend argument can cause nil to be returned where not
expected.
Diffstat (limited to 'state.rb')
-rw-r--r-- | state.rb | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -111,7 +111,7 @@ class State # Parameters to this state def params - @deps.map{ |x| x.params }.inject{ |x,y| x.merge y }.merge \ + @deps.map{ |x| x.params }.inject({}){ |x,y| x.merge y }.merge \ @holds.map{ |x| x.params }.inject{ |x,y| x.merge y } end @@ -147,7 +147,7 @@ class State def rooted_in(set) @deps.inject(true){ |x,y| x and y.rooted_in set } and \ self.class.depends.map{ |x| set.select{ |y| x === y } } \ - .inject{ |x, y| x+y }.to_set.subset? @deps + .inject([]){ |x, y| x+y }.to_set.subset? @deps end # Create a new type of state. +name+ is capitalized and postfixed with "State" |