lib/services/entity.rb in jn_services-1.0.1 vs lib/services/entity.rb in jn_services-1.0.2

- old
+ new

@@ -51,21 +51,18 @@ def _load return unless valid_path to_hash.each do |k, v| next if k == 'name' - value = Services.get("#{KEY}/#{path}/#{k}").value - instance_variable_set "@#{k}", value + if Services.exists? "#{KEY}/#{path}/#{k}" + value = Services.get("#{KEY}/#{path}/#{k}").value + instance_variable_set "@#{k}", value + end end self end def valid_path - begin - Services.get("#{KEY}/#{path}") - rescue - return false - end - true + Services.exists?("#{KEY}/#{path}") end end end