From: Bernard Lambeau Date: 2011-07-13T04:58:57+09:00 Subject: [ANN] summaryse 1.1.0 Released --bcaec53f9467cb1a0a04a7e4ba4a Content-Type: text/plain; charset=ISO-8859-1 summaryse version 1.1.0 has been released! sudo gem summaryse After birthday yesterday, I already reached a second milestone. A lot of useful features added for fun and profit! Examples are given in the changelog exerpt below. Array#summaryse * * Summarize arrays with full power. As a side effect, this gem allows merging multiple YAML configuration files with power, without sacrifying simplicity... Changes: # 1.1.0 / 2011.07.12 * Added a way to register user-defined aggregation functions: Summaryse.register(:comma_join) do |ary| ary.join(', ') end [1, 4, 12, 7].summaryse(:comma_join) # => "1, 4, 12, 7" * Added the ability to specify aggregations on hash keys that are not used at all. In this case, the aggregator is called on an empty array. [ { :size => 12 }, { :size => 17 } ].summaryse(:size => :max, :hobbies => lambda{|a| a}) # => {:size => 17, :hobbies => []} * Added the ability to use objects responding to to_summaryse as aggregator functions: class Foo def to_summaryse; :sum; end end [1, 2, 3].summaryse(Foo.new) # => 6 * Added the ability to explicitly bypass Hash entries as the result of a computation, by returning Summaryse::BYPASS [ { :hobbies => [:ruby], :size => 12 }, { :hobbies => [:music], :size => 17 } ].summaryse(:size => :max, :hobbies => lambda{|a| Summaryse::BYPASS}) # => {:size => 17} * The semantics of aggregating empty arrays is guaranteed. Due to duck typing, nil is returned in almost all cases except :count so far. This is specified in README. * Best-effort for yielding friendly hash ordering under ruby >= 1.9 * Array#summaryse now raises an ArgumentError when it does not understand its aggregator argument. Enjoy! B -- PhD Student, Computer Science Department, EPL/INGI, UCLouvain, Belgium Mail: blambeau@gmail.com Mobile: +32 477 24 58 61 Blog: http://revision-zero.org/ Code: http://github.com/blambeau/ Follow: http://twitter.com/blambeau/ --bcaec53f9467cb1a0a04a7e4ba4a--