lib/services/entity.rb in jn_services-1.0.7 vs lib/services/entity.rb in jn_services-1.0.8
- old
+ new
@@ -7,11 +7,11 @@
# entity base class.
# member,service,endpoint are all "services::entity"
class Entity
attr_reader :name, :path
- def initialize(name, args = {})
+ def initialize(name, _args = {})
@name = name
validate
end
def store
@@ -49,16 +49,16 @@
end
end
def _load
return unless valid_path
- to_hash.each do |k, v|
+ to_hash.each do |k, _v|
next if k == 'name'
- if Services.exists? "#{KEY}/#{path}/#{k}"
- value = Services.get("#{KEY}/#{path}/#{k}").value
- Etcd::Log.debug "Got #{value} from #{KEY}/#{path}/#{k}"
- instance_variable_set "@#{k}", value
- end
+ next unless Services.exists? "#{KEY}/#{path}/#{k}"
+
+ value = Services.get("#{KEY}/#{path}/#{k}").value
+ Etcd::Log.debug "Got #{value} from #{KEY}/#{path}/#{k}"
+ instance_variable_set "@#{k}", value
end
self
end
def valid_path