lib/swing_support/extensions/attributes.rb in swing-0.1.4 vs lib/swing_support/extensions/attributes.rb in swing-0.1.5
- old
+ new
@@ -48,15 +48,20 @@
[name, result] unless result.nil?
end.compact
# yield opts if block_given?
attributes.each { |(name, value)| component.send "#{name}=", *value }
- # Post-process non-setter opts
- add_component component, opts[:parent]
+ # Post-process non-setter opts (setter opts are already consumed by now)
+ post_process component, opts
component
end
# Post-processing (non-setter) options given to initialize
+ def post_process component, opts
+ add_component component, opts[:parent]
+ end
+
+ # Proper way to add this component to its parent
def add_component component, parent
parent.add component if parent
end
end
end