summaryrefslogtreecommitdiffstats
path: root/state.rb
diff options
context:
space:
mode:
authorCasey Dahlin <cdahlin@redhat.com>2008-10-03 17:47:10 -0400
committerCasey Dahlin <cdahlin@redhat.com>2008-10-03 17:47:10 -0400
commitfd3735a1f6b6ccdfde1856116e001c3c3b863f4f (patch)
treeedfbbd78f71f72e85d54ec1d00089dd8bbe56896 /state.rb
parentdc1cc9c4078603c89ec91432d12433d65fecc8eb (diff)
downloadupstate-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.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/state.rb b/state.rb
index a7920ae..b45ebb5 100644
--- a/state.rb
+++ b/state.rb
@@ -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"