lib/rumx/hash_attribute.rb in rumx-0.1.2 vs lib/rumx/hash_attribute.rb in rumx-0.1.3
- old
+ new
@@ -7,10 +7,11 @@
@hash_type = Type.find(options[:hash_type])
end
def each_attribute_info(bean, ancestry, &block)
hash = bean.send(name)
+ return unless hash
child_ancestry = ancestry+[name]
index_index = child_ancestry.size
hash.each do |name, value|
value = nil unless allow_read
child_ancestry[index_index] = name
@@ -22,11 +23,12 @@
#puts "hash write params=#{params.inspect}"
return false unless params.kind_of?(Hash)
is_written = false
if allow_write
hash = bean.send(name)
+ return false unless hash
param_value(params) do |hash_params|
- if hash && hash_params && hash_params.kind_of?(Hash)
+ if hash_params && hash_params.kind_of?(Hash)
hash_params.each do |name, value|
hash[name.to_sym] = @hash_type.string_to_value(value)
is_written = true
end
end