Class: ZerigoDNS::Base
- Inherits:
-
ActiveResource::Base
- Object
- ActiveResource::Base
- ZerigoDNS::Base
- Defined in:
- lib/zerigodns/base.rb
Direct Known Subclasses
Class Attribute Summary collapse
-
.secure ⇒ Object
Returns the value of attribute secure.
Instance Method Summary collapse
-
#load(attributes, remove_root = false) ⇒ Object
fix load() so that it no longer clobbers @prefix_options also fix bug exposed by reload() where attributes is effectively parsed twice, causing the first line to raise an exception the 2nd time.
Class Attribute Details
.secure ⇒ Object
Returns the value of attribute secure.
4 5 6 |
# File 'lib/zerigodns/base.rb', line 4 def secure @secure end |
Instance Method Details
#load(attributes, remove_root = false) ⇒ Object
fix load() so that it no longer clobbers @prefix_options also fix bug exposed by reload() where attributes is effectively parsed twice, causing the first line to raise an exception the 2nd time
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/zerigodns/base.rb', line 22 def load(attributes, remove_root = false) raise ArgumentError, "expected an attributes Hash, got #{attributes.inspect}" unless attributes.is_a?(Hash) , attributes = (attributes) .merge!() attributes.each do |key, value| @attributes[key.to_s] = case value when Array if value.all?{|v2| v2.kind_of?(ActiveResource::Base)} value.dup rescue value else resource = find_or_create_resource_for_collection(key) value.map { |attrs| attrs.is_a?(String) ? attrs.dup : resource.new(attrs) } end when Hash resource = find_or_create_resource_for(key) resource.new(value) else value.dup rescue value end end self end |