lib/cfoundry/v2/app.rb in cfoundry-0.5.0 vs lib/cfoundry/v2/app.rb in cfoundry-0.5.1.rc1

- old
+ new

@@ -41,10 +41,14 @@ has_summary :urls => proc { |x| self.cache[:uris] = x }, :running_instances => proc { |x| self.cache[:running_instances] = x }, + :instances => proc { |x| + self.total_instances = x + }, + # TODO: remove these when cc consistently returns nested hashes :framework_guid => proc { |x| if f = self.cache[:framework] f.guid = x else @@ -102,17 +106,17 @@ def services service_bindings.collect(&:service_instance) end def env - @env ||= CFoundry::ChattyHash.new( + CFoundry::ChattyHash.new( method(:env=), - environment_json) + stringify(environment_json)) end def env=(x) - self.environment_json = x.to_hash + self.environment_json = stringify(x.to_hash) end def debug_mode # TODO v2 nil end @@ -292,9 +296,21 @@ Instance.new(self, "0", @client).file(*path) end def stream_file(*path, &blk) Instance.new(self, "0", @client).stream_file(*path, &blk) + end + + private + + def stringify(hash) + new = {} + + hash.each do |k, v| + new[k.to_s] = v.to_s + end + + new end class Instance attr_reader :app, :id