lib/swing_support/extensions/attributes.rb in swing-0.1.14 vs lib/swing_support/extensions/attributes.rb in swing-0.1.15
- old
+ new
@@ -1,7 +1,5 @@
-import java.awt.Dimension
-
module SwingSupport
module Extensions
# Module allows including classes to receive attribute values in an *opts* Hash
# and sets those attributes after object initialization
module Attributes
@@ -42,11 +40,11 @@
end
# Sets attributes after calling original new
def new_with_attributes(*args, &block)
opts = args.last.is_a?(Hash) ? args.pop.dup : {}
- component = self.new_without_attributes(*args) #, &block)
+ component = self.new_without_attributes(*args, &block)
# Extract known attributes given in opts,
# run default actions on them, or return known defaults
attributes = attributes().map do |name, default|
value = opts.delete name
@@ -75,11 +73,9 @@
# Post-process non-setter opts (setter opts are already consumed by now)
component.post_process opts
# Raises exception if any of the given options left unprocessed
raise "Unrecognized options: #{opts}" unless opts.empty?
-
- yield component if block_given?
component
end
end
end