lib/hcloud/entry_loader.rb in hcloud-0.1.1 vs lib/hcloud/entry_loader.rb in hcloud-0.1.2
- old
+ new
@@ -3,28 +3,28 @@
module EntryLoader
extend ActiveSupport::Concern
included do |klass|
klass.send(:attr_reader, :parent, :client)
- klass.const_get(:Attributes).each do |attribute, value|
+ klass.const_get(:Attributes).each do |attribute, _value|
klass.send(:attr_accessor, attribute)
end
end
def initialize(resource, parent, client)
@parent = parent
@client = client
self.class.const_get(:Attributes).each do |attribute, value|
case value
when nil
- self.send("#{attribute}=", resource[attribute.to_s])
+ send("#{attribute}=", resource[attribute.to_s])
when :time
unless resource[attribute.to_s].nil?
- self.send("#{attribute}=", Time.parse(resource[attribute.to_s]))
+ send("#{attribute}=", Time.parse(resource[attribute.to_s]))
end
- else
- if value.is_a?(Class) and value.include?(EntryLoader)
- self.send("#{attribute}=", value.new(resource[attribute.to_s], self, client))
+ else
+ if value.is_a?(Class) && value.include?(EntryLoader)
+ send("#{attribute}=", value.new(resource[attribute.to_s], self, client))
end
end
end
end