lib/sprout/executable.rb in sprout-1.0.16.pre vs lib/sprout/executable.rb in sprout-1.0.17.pre

- old
+ new

@@ -82,10 +82,11 @@ raise Sprout::Errors::UsageError.new "The type parameter must be a Class by reference" if !type.is_a?(Class) options ||= {} options[:name] = name options[:type] = type + # TODO: Integrate the RDOC-parsed parameter description here: #options[:description] ||= Sprout::RDocParser.description_for_caller caller.shift create_param_accessors options static_parameter_collection << options options @@ -448,17 +449,25 @@ assembled_static_collection :static_default_value_collection end def assembled_static_collection collection_name collection = [] - clazz = self.class - while clazz do - if clazz.respond_to?(collection_name) + inheritance_chain.reverse.each do |clazz| + if(clazz.respond_to?(collection_name)) collection.concat clazz.send(collection_name) end - clazz = clazz.superclass end collection + end + + def inheritance_chain + chain = [] + clazz = self.class + while clazz do + chain << clazz + clazz = clazz.superclass + end + chain end def add_help_param option_parser.on '--help', 'Display this help message' do puts option_parser.to_s