lib/disposable/twin/setup.rb in disposable-0.3.1 vs lib/disposable/twin/setup.rb in disposable-0.3.2
- old
+ new
@@ -21,17 +21,20 @@
def setup_properties!(options)
schema.each { |dfn| setup_property!(dfn, options) }
end
def setup_property!(dfn, options)
- value =
- if options.has_key?(name = dfn[:name].to_sym)
- options[dfn[:name].to_sym]
- else
- setup_value_for(dfn, options)
- end
+ if options.has_key?(name = dfn[:name].to_sym)
+ value = options[dfn[:name].to_sym]
+ return setup_write!(dfn, value)
+ end
+ value = setup_value_for(dfn, options)
+
+ # this sucks and is why i introduce pipetrees in 0.4.
+ return if dfn[:readable] == false && dfn[:default].nil?
+
setup_write!(dfn, value) # note: even readable: false will be written to twin as nil.
end
def setup_value_for(dfn, options) # overridden by Default.
return if dfn[:readable] == false
@@ -53,6 +56,6 @@
write_property(dfn[:name], value, dfn)
end
end
end # Setup
end
-end
\ No newline at end of file
+end