From transfire at gmail.com Wed Feb 6 10:02:56 2008 From: transfire at gmail.com (Trans) Date: Wed, 6 Feb 2008 07:02:56 -0800 (PST) Subject: [Facets] [ facets-Patches-17243 ] ForwardableChain: a superset of Ruby Core Forwardable enabling chains of delegates In-Reply-To: <20080120043412.545271858673@rubyforge.org> References: <20080120043412.545271858673@rubyforge.org> Message-ID: <7fb9211f-2528-4caf-ba84-9f4699e24692@p69g2000hsa.googlegroups.com> On Jan 19, 11:34 pm, wrote: > Patches item #17243, was opened at 2008-01-19 22:34 > You can respond by visiting:http://rubyforge.org/tracker/?func=detail&atid=3171&aid=17243&group_i... > > Category: None > Group: None > Status: Open > Resolution: None > Priority: 3 > Submitted By: Nils Jonsson (njonsson) > Assigned to: Nobody (None) > Summary: ForwardableChain: a superset of Ruby Core Forwardable enabling chains of delegates > > Initial Comment: > The ForwardableChain module is a superset of the capabilities of Forwardable. It provides delegation of specified methods to a chain of designated objects, using the class method _def_delegator_chain_. This class method becomes available to your module when ForwardableChain is included in your module as in the example below. (Note: *include* rather than _extend_.) Your module will reveal ForwardableChain to be in its type hierarchy (see Module#ancestors), which can be useful for debugging. > > The pattern implemented by ForwardableChain is useful in creating presenter classes and facade classes whose purpose is to abstract away the complexity of working with graphs of objects. I'll give this consideration. Thanks for the submission. One thought that crossed my mind in looking at it: Could this be made an extension to Forwardable, rather than a separate module? T. From noreply at rubyforge.org Wed Feb 6 14:05:55 2008 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Wed, 6 Feb 2008 14:05:55 -0500 (EST) Subject: [Facets] [ facets-Bugs-11357 ] String#similarity dies when there are parentheses in string to be matched Message-ID: <20080206190555.8751A18585D1@rubyforge.org> Bugs item #11357, was opened at 2007-06-04 15:27 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=3169&aid=11357&group_id=804 >Category: Code >Group: 1.0 - 2.0 >Status: Closed >Resolution: Accepted Priority: 3 Submitted By: Jeremy Stephens (viking415) Assigned to: Nobody (None) Summary: String#similarity dies when there are parentheses in string to be matched Initial Comment: Running this: "(123) 456-7890".fuzzy_match("(123) 465-7980") Causes this exception: RegexpError: unmatched ): /) / from /usr/lib/ruby/gems/1.8/gems/facets-1.8.54/lib/facets/core/string/similarity.rb:73:in `initialize' from /usr/lib/ruby/gems/1.8/gems/facets-1.8.54/lib/facets/core/string/similarity.rb:73:in `compile' from /usr/lib/ruby/gems/1.8/gems/facets-1.8.54/lib/facets/core/string/similarity.rb:73:in `fuzzy_match' from /usr/lib/ruby/gems/1.8/gems/facets-1.8.54/lib/facets/core/string/similarity.rb:72:in `each_index' from /usr/lib/ruby/gems/1.8/gems/facets-1.8.54/lib/facets/core/string/similarity.rb:72:in `fuzzy_match' The fix is quite simple. I've attached a patch that wraps the string in question with Regexp.escape(). ---------------------------------------------------------------------- >Comment By: 7rans (transami) Date: 2008-02-06 14:05 Message: This has been fixed. Thanks for the report, Jeremy. Please note that this library is now part of the English project --a new release of with, with this fix, will be released shortly. ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=3169&aid=11357&group_id=804 From ! at phrogz.net Wed Feb 6 14:01:04 2008 From: ! at phrogz.net (Gavin Kistner) Date: Wed, 6 Feb 2008 12:01:04 -0700 Subject: [Facets] Set#power_set and Array#power_set Message-ID: <002c01c868f2$a0352170$3b00a8c0@anark.com> I propose the addition of Set#power_set and Array#power_set. For more information on power sets, see http://en.wikipedia.org/wiki/Power_set I propose this for Sets because it is the appropriate class. p Set[1,2,3].power_set #=> #, #, #, #, #=> #, #, #, #}> I also propose this for Arrays because the implementation comes out about 20x faster. p [1,2,3].power_set #=> [ [], [1], [2], [1, 2], [3], [1, 3], [2, 3], [1, 2, 3] ] The output order isn't quite what I'd like, but I don't think the order is intrinsically an important part of the result. For a simpler ordering, it's easy enough to do: # Assumes the items in the set are mutually comparable p [1,2,3].power_set.sort_by{ |a| [a.length, a] } #=> [ [], [1], [2], [3], [1, 2], [1, 3], [2, 3], [1, 2, 3] ] In the following, I've included a pair of (failed) attempts to make the Set implementation faster. I welcome any advice on how to speed it up, even if it relies on the internal implementation of Set. I've also included two additional implementations for Array. The first (#power_set2) avoids a lot of duplicating arrays. Surprisingly, even with 32k arrays, it doesn't make a difference in speed or (in my testing) Ruby's overall memory allocation. The second (#power_set3) is included as a reference to show that the inject implementation--which shows up in various Google hits, all referencing the cited blog--is about twice as slow (despite being terse and tricky). To be clear, I'm only suggesting that the two #power_set methods be added to facets. __END__ require 'set' class Set def power_set if empty? Set[ self ] else any_value = [to_a.first] subsubs = (self - any_value).power_set subsubs + subsubs.map{ |subset| subset + any_value } end end def power_set2 if @hash.empty? Set[ self ] else any_value = [ @hash.keys.first ] subsubs = (self - any_value).power_set2 subsubs + subsubs.map{ |subset| subset + any_value } end end def power_set3 Set.new( to_a.power_set.map{ |subset| Set.new( subset ) } ) end end class Array def power_set if empty? [self] else subset = dup value = [ subset.pop ] subsubs = subset.power_set subsubs.concat( subsubs.map{ |subset| subset + value } ) end end def power_set2( preserve_original = true ) if empty? [self] else subset = preserve_original ? dup : self value = [ subset.pop ] subsubs = subset.power_set2( false ) subsubs.concat( subsubs.map{ |subset| subset + value } ) end end def power_set3 # From http://johncarrino.net/blog/2006/08/11/powerset-in-ruby/ inject([[]]){|c,y|r=[];c.each{|i|r< Rehearsal ---------------------------------------- #=> set 2.422000 0.031000 2.453000 ( 2.495000) #=> set2 2.359000 0.000000 2.359000 ( 2.349000) #=> set3 3.141000 0.000000 3.141000 ( 3.167000) #=> a1 0.109000 0.000000 0.109000 ( 0.098000) #=> a2 0.078000 0.000000 0.078000 ( 0.098000) #=> a3 0.360000 0.016000 0.376000 ( 0.369000) #=> ------------------------------- total: 8.516000sec #=> user system total real #=> set 2.078000 0.000000 2.078000 ( 2.071000) #=> set2 2.016000 0.000000 2.016000 ( 2.069000) #=> set3 2.109000 0.000000 2.109000 ( 2.103000) #=> a1 0.094000 0.000000 0.094000 ( 0.096000) #=> a2 0.094000 0.000000 0.094000 ( 0.096000) #=> a3 0.187000 0.000000 0.187000 ( 0.184000) end From ! at phrogz.net Wed Feb 6 14:01:04 2008 From: ! at phrogz.net (Gavin Kistner) Date: Wed, 6 Feb 2008 12:01:04 -0700 Subject: [Facets] What happened to the docs? Message-ID: <002b01c868f2$9fce9770$3b00a8c0@anark.com> Slim2:~ phrogz$ sudo gem uninstall facets Successfully uninstalled facets-2.0.2 Slim2:~ phrogz$ sudo gem install facets Bulk updating Gem source index for: http://gems.rubyforge.org Successfully installed facets-2.2.1 1 gem installed Slim2:~ phrogz$ sudo fastri-server -b ... Indexing RI docs for cgi_multipart_eof_fix version 2.5.0. Indexing RI docs for daemons version 1.0.8. Indexing RI docs for fastercsv version 1.2.1. Indexing RI docs for fastri version 0.3.0.1. ... Building index. Indexed: * 10500 methods * 2071 classes/modules Needed 0.639519 seconds Slim2:~ phrogz$ qri collate nil Slim2:~ phrogz$ ri collate Nothing known about collate Slim2:~ phrogz$ cd /usr/local/lib/ruby/gems/1.8/gems/facets-2.2.1/ Slim2:facets-2.2.1 phrogz$ findfile collate ./lib/core/facets/enumerable/collate.rb ./lib/core/facets/hash/collate.rb ./test/unit/hash/test_collate.rb Found 3 files (out of 871) in 0.024647 seconds I saw the same results under Windows. From transfire at gmail.com Mon Feb 11 16:54:48 2008 From: transfire at gmail.com (Trans) Date: Mon, 11 Feb 2008 13:54:48 -0800 (PST) Subject: [Facets] What happened to the docs? In-Reply-To: <002b01c868f2$9fce9770$3b00a8c0@anark.com> References: <002b01c868f2$9fce9770$3b00a8c0@anark.com> Message-ID: On Feb 6, 2:01 pm, "Gavin Kistner" wrote: > Slim2:~ phrogz$ sudo gem uninstall facets > Successfully uninstalled facets-2.0.2 > > Slim2:~ phrogz$ sudo gem install facets > Bulk updating Gem source index for:http://gems.rubyforge.org > Successfully installed facets-2.2.1 > 1 gem installed > > Slim2:~ phrogz$ sudo fastri-server -b > ... > Indexing RI docs for cgi_multipart_eof_fix version 2.5.0. > Indexing RI docs for daemons version 1.0.8. > Indexing RI docs for fastercsv version 1.2.1. > Indexing RI docs for fastri version 0.3.0.1. > ... > Building index. > Indexed: > * 10500 methods > * 2071 classes/modules > Needed 0.639519 seconds > > Slim2:~ phrogz$ qri collate > nil > > Slim2:~ phrogz$ ri collate > Nothing known about collate > > Slim2:~ phrogz$ cd /usr/local/lib/ruby/gems/1.8/gems/facets-2.2.1/ > Slim2:facets-2.2.1 phrogz$ findfile collate > ./lib/core/facets/enumerable/collate.rb > ./lib/core/facets/hash/collate.rb > ./test/unit/hash/test_collate.rb > Found 3 files (out of 871) in 0.024647 seconds > > I saw the same results under Windows. Facets doesn't auto-generate the rdocs on install b/c they would be an utter mess, because Facets consists of such a large collection of libraries. The Rdocs have to be built in a special way, as they are on the Facets website. Unfortunately, because the rdocs aren't auto- generated, apparently ri docs aren't either. Personally, I wish RubyGems didn't do this. Ever since Gems started generating ri docs, the ri tool has become much less useful to me b/c now I have to weed through many many more methods to find what I'm looking for. And the --system option doesn't work! So unless I've overlooked an easy fix to this, it kind of pisses me off. I would much rather have ri just serve up ruby docs, and if I want ri for installed libs allows me to specify the package, ex. "ri --lib=facets collate". Alas, to make matters worse, I think Eric Hodel has decided (in his infinite wisdom) that the rdocs should ALWAYS be auto-generated. So far he's only implemented a warning when building the gem, but I suspect this is a precursor to always generating them. This is just plan wrong to me. I've been hoping someone resurrects Yard. What happens then? "Sorry, only RDocs allowed"? It's not very fair. Honestly I'm getting tired of it. How RubyGems has managed to hijack Ruby, so now there is no choice --one HAS to host on Rubyforge, one has to use RDoc, one can't get ri's without the RDocs. Not to mention rdoc issues/bugs that never get fixed just b/c they don't effect Eric. Okay, I'm ranting. Sorry. I guess I'll just have to let the rdocs be auto-generated despite their quality. In the mean time I think you can drop down into the facets gem directory and run "rdoc -r". T. From transfire at gmail.com Mon Feb 11 17:03:31 2008 From: transfire at gmail.com (Trans) Date: Mon, 11 Feb 2008 14:03:31 -0800 (PST) Subject: [Facets] Set#power_set and Array#power_set In-Reply-To: <002c01c868f2$a0352170$3b00a8c0@anark.com> References: <002c01c868f2$a0352170$3b00a8c0@anark.com> Message-ID: <5d856e72-531d-4528-bb84-d986c1b71133@j20g2000hsi.googlegroups.com> I added the two methods to the more library as set.rb. Thanks! Don't have to time to consider how to speed it up right now. Maybe you could post to ruby-talk and see what comes up. T. From transfire at gmail.com Mon Feb 18 19:43:11 2008 From: transfire at gmail.com (Trans) Date: Mon, 18 Feb 2008 16:43:11 -0800 (PST) Subject: [Facets] ANN: Facets 2.3.0 Message-ID: <329c6719-8047-4260-8b9e-8f24973fabeb@d21g2000prf.googlegroups.com> = Ruby Facets http://facets.rubyforge.com "ALL YOUR BASE ARE BELONG TO RUBY" == Introduction Ruby Facets is the single largest collection of general purpose method extensions and system additions for the Ruby programming language. The core extensions is a large collection of methods which extend the core capabilities of Ruby's built-in classes and modules. This collection of extension methods are unique by virtue of their atomicity. The methods are stored in relatively small groups of tightly coupled methods so that each can be required independently. This gives developers the potential for much finer control over which extra methods to bring into their code. The "more" additions are a collection of classes, modules and light meta-systems which constitutes an ever improving source of reusable components. Some very nice additions are provided, from the simple Functor class to a full-blown annotations system. == Documentation Facets has special documentation needs due to it's extensive bredth. For this reason, RDocs are not automatically generated when installing via RubyGems. Unfortunately this also prevents RI docs from being created. Hopefully we can remedy this in the future. In the mean time you can manually create them by navigating to the package directory (either the gem or tgz) and running 'rdoc --ri-site' (recommended destination). Online documentation is available at http://facets.rubyforge.org/learn.html. There is a "Quick Doc" feature that can be a bit more convenient then the usual RDocs. Prior to 2.3.1 off-line docs had to be downloaded via a separate package, but this is no longer the case. I've seen past the stigma of not including documentation along with the package itself (the extra 500K isn't even a floppy disk folks!), so you will find them in the doc/ directory of whatever package you have chosen to install. In fact, a good package installer should give you the option to install those in the appropriate place in your system (eg. in /usr/ share/doc/facets/). == RELEASE NOTES Facets 2.3.0 has been released. Facets 2.3 makes some nice internal reorganization, rather then just the split between core/ and more/, we have added class/ and mixin/. This helps a great deal in working with the library. If does not effect the end-user in anyway however --even so we felt it enough to warrent a minor version bump rather than just a tiny. Amoung other changes with this release, cloneable.rb is now a true deep dup/clone mixin; tracepoint.rb returns to the library; and ... As of 2.2.1: This release get rid of the underlying methods subdir. All method redirects are now in core, to ensure there are no more name clashes. As of 2.2.0: This release provides improved rdocs and prepares facets for use with RUby 1.9. It also adds Matthew Harris' duration.rb library. Bug thanks to Matthew! As of 2.1.0: Major changes include a new and much-improved command.rb, a new BiCrypt class for simple two-way crypotgraphy, as well as attr_reader!, attr_writer! and attr_accessor! for flag attributes, plus alias_xxx methods for all attr_xxx methods. Enjoy! http://facets.rubyforge.org == CHANGES == 2.3.0 / 2008-02-18 * Reorganized library into four groups: core, more, class and mixin. * Added tracepoint.rb back to the library. * Fixed multiglob_r bug, so it will NOT follow symlinks. == 2.2.1 / 2007-12-22 * Got rid of methods subdir. All method redirects are in core/. == 2.2.0 / 2007-12-13 * A lot of rdoc updates to core extensions --as promised ;) * Just about every method now has at least a brief explination and an example. * integer/bitmask.rb has changed a bit --pun intended ;) Deprecated some methods and now use "~" instead of "-" to clear bits. * The name Array#unzip didn't makes sense, it was renamed to #modulate (though #collate seems better?) * Renamed Enumerable#collate to #mash (Map hASH); #collate and #graph remain aliases for the time being. * Deprecated Module#include_and_extend. Just use both silly. * More lib pp_s.rb has been removed. Use #pretty_inspect instead. * Split binding extensions up a bit more finely --eval.rb sprouted here.rb, self.rb and defined.rb. * Move Time#stamp out of conversion.rb and into time/ dir, and remove to_s alias. * Preliminary addition of Matthew Harris' excellent duration.rb lib (will integrate with times.rb better in future). * Added if clauses to handle upcoming Ruby 1.9 gracefully. Facets should now be just about ready for use with 1.9. == Installation The easiest way to install is via RubyGems. gem install facets To install manually, download and unpack the .tar.gz package and use the included task/install script. Eg. tar -xvzf facets-2.x.x.tar.gz cd facets-2.x.x sudo task/install On Window the last step will be: C:\> ruby task/install IMPORTANT! Note that setup.rb is no longer used b/c of Facets' new layout. == Compatibility with 1.x series. Prior to 2.0, Facets was divided between CORE and MORE --standalone extensions vs. classes and modules, respectively. With 2.0, the notion of "CORE" has taken only a slightly different meaning. Instead CORE now consists of the libraries that are thought essential and as such are loaded automatically when using ++require "facets"++. While still primarily made up of extension methods a few classes now belong to core as well. Additionally, the extension methods are no longer stored on a per- method basis. While dividing the extension methods up on a per-method basis had certain advantages, not the least of which was a simple organization, it proved too granular --more "subatomic" than "atomic". With 2.0 we have address this issue. All the extension methods have now been organized into small tightly related groups. However, being able to require on the basis of a method is still a useful approach, so a compatibility layer for the 1.x series has been created. It makes it possible to load Facets libraries on a per method basis, just as before, via require redirection. For example: require 'facets/string/underscore' Will redirect according to the content of the underscore.rb file which is: require 'facets/string/stylize' So the underscore method will be loaded just as before. But a few other *stylization* methods will also be loaded. This actually proves a more useful approach because quite often a related method is needed as well. The other significant change from 1.x to 2.0 is the removal of some libraries that were considered too extraneous for a general purpose library. Most of these were spun-off to their own projects. In particular, the web-related libs are now part of Blow (http:// blow.rubyforge.org), inflection libraries are in English (http:// english.rubyforge.org), units.rb along with constants.rb are in Stick (http://stick.rubyforge.org), and the persistance system in Opod (http://opod.rubyforge.org). == Mission Facets holds to the notion that the more we can reasonably integrate into a common foundation directed toward general needs, the better that foundation will be able to serve everyone. There are a number of advantages here: * Better Code-reuse * Collaborative Improvements * Greater Name Consistency * One-stop Shop and Installation == Usage For detailed usage of any given method or module please refer to the API RDocs. http://facets.rubyforge.org/learn.html Most libraries are well documented. Assistance in improving documentation though is always appreciated. If you plan to use more then a few of Facets core method it is recommended that you require require the main facility. require 'facets' This loads all the CORE functionality at once. Of course you can use the CORE library piecemeal if you prefer. The general require statement for a core extensions library is: require 'facets//' For example: require 'facets/time/stamp' Most "atoms" contain only a few methods, sometimes only one, but a few exceptions provide quite a few methods, such as ++string/indexable.rb+ +. You can load per-class or per-module groups of core methods by requiring the class or module by name. For example" require 'facets/time' Will require all the Time method extensions. Note that some methods that were part of CORE in 1.8 and earlier are now part of MORE libraries. A good example is 'random.rb'. There were separated because they had more specialized use cases, where as CORE extensions are intended as general purpose. Using a Facets/MORE library of modules, classes or microframeworks is essentially the same. For example: require 'facets/basicobject' Again, for details pertaining to the functionality of each feature, please see the API Docs. == Method File Names Operator method redirect files are stored using English names. For instance for Proc#* is 'proc/op_mul'. For reference, here is the chart. +@ => op_plus_self -@ => op_minus_self + => op_plus - => op_minus ** => op_pow * => op_mul / => op_div % => op_mod ~ => op_tilde <=> => op_cmp << => op_lshift >> => op_rshift < => op_lt > => op_gt === => op_case_eq == => op_equal =~ => op_apply <= => op_lt_eq >= => op_gt_eq | => op_or & => op_and ^ => op_xor []= => op_store [] => op_fetch Facets simply takes the '*' and translates it into a string acceptable to all file systems. Also, if a method ends in '=', '?' or '!' it is simply removed. == Contribute This project thrives on contribution. If you have any extension methods, classes, modules or small frameworks that you think have general applicability and would like to see them included in this project, don't hesitiate to submit. There's a very good chance they will be included. Also, if you have better versions of any thing already included or simply have a patch, they too are more than welcome. We want Ruby Facets to be of the highest quality. == Authors This collection was put together by, and largely written by Thomas Sawyer (aka Trans). He can be reached via email at transfire at gmail.com. Some parts of this collection were written and/or inspired by other persons. Fortunately nearly all were copyrighted under the same open license, the Ruby License. In the few exceptions I have included the copyright notice with the source code. Any code file not specifically labeled shall fall under the Ruby License. In all cases, I have made every effort to give credit where credit is due. You will find these copyrights, thanks and acknowledgments embedded in the source code, and an unobtrusive "Author(s)" section is given in the RDocs. Also see the AUTHORS file for a list of all contributing Rubyists. If anyone is missing from the list, please let me know and I will correct right away. Thanks. == License The collection PER COLLECTION is licensed as follows: Ruby Facets Copyright (c) 2004-2006 Thomas Sawyer Distributed under the terms of the Ruby license. The Ruby license is a dual license that also provides for use of the GPL. Complete texts of both licenses accompany this document (see LICENSE). Acknowledgments and Copyrights for particular snippets of borrowed code are given in their respective source. All licenses are either compatible with the Ruby license (namely the GPL) or the original author has given permission for inclusion of their code under such license. ALL YOUR BASE ARE BELONG TO RUBY! Ruby Facets, Copyright (c)2005,2006,2007,2008 Thomas Sawyer Do you Ruby? (http://ruby-lang.org) From transfire at gmail.com Mon Feb 18 20:32:04 2008 From: transfire at gmail.com (Trans) Date: Mon, 18 Feb 2008 17:32:04 -0800 (PST) Subject: [Facets] Quick note about 2.3+ Message-ID: <271bee66-2382-4610-a45a-7064917e8008@d4g2000prg.googlegroups.com> Hi-- I released Facets 2.3.0 today. The new release fixes some known issues and adds a couple of new bits or code. Fairly straight forward update. The major number jumped because I restructured the lib internally a fair bit. Where there used to be just core/ and more/, there is now core/, more/, class/ and mixin/. Also, please let me know if you have any issues with installing, testing and/or loading. I recently switched over to a new build system --a redesign of the one I had been using. Lastly, as of 2.3.1, I am going to start including pre-built rdocs in the package. Facets has some special RDocs because of it's scope, so just running rdoc on them, like RubyGems wants to do, does not provide a very usable set of docs. After struggling a long while trying to figure out how to build them properly within the confines of rdoc's standard means of generation (even going so far as to divide Facets up into 70+ separate mini-packages!!!) it finally dawned on me that I was suffering from some strange unconscious delusion on the scarcity of bandwidth and storage. When this simple solution finally dawned on me I felt like a moron! And apparently, a large number of very smart people are suffering from this wide-spread delusion too. There is still one issue however, RubyGems will not generate the RI docs if it doesn't also generate the RDocs. That's unfortunate, since I really don't want to generate a whole extra set of worthless docs, in order to get the RI docs --however, it looks as if RubyGems is storing the generated RI docs in with the Ruby core and standard library docs anyway --which sucks in itself. So for now it better not to include them anyway. If you want the RI docs, please navigate to the package directory and run "rdoc --ri--site". That should do the trick. T. From noreply at rubyforge.org Fri Feb 22 14:34:36 2008 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Fri, 22 Feb 2008 14:34:36 -0500 (EST) Subject: [Facets] [ facets-Bugs-18300 ] Stackable.peek REMOVES last item, like pop Message-ID: <20080222193436.D2E611858600@rubyforge.org> Bugs item #18300, was opened at 2008-02-22 14:34 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=3169&aid=18300&group_id=804 Category: Code Group: 2.0 + Status: Open Resolution: None Priority: 3 Submitted By: Dan Bernier (danbernier) Assigned to: Nobody (None) Summary: Stackable.peek REMOVES last item, like pop Initial Comment: Stackable's peek modifies the underlying array, acting like pop. In fact, the methods are implemented the same way, using splice(-1). Attached is a file that demonstrates the problem, and provides a fix. ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=3169&aid=18300&group_id=804 From noreply at rubyforge.org Sat Feb 23 15:54:01 2008 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Sat, 23 Feb 2008 15:54:01 -0500 (EST) Subject: [Facets] [ facets-Bugs-18300 ] Stackable.peek REMOVES last item, like pop Message-ID: <20080223205401.13AF51858677@rubyforge.org> Bugs item #18300, was opened at 2008-02-22 14:34 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=3169&aid=18300&group_id=804 Category: Code Group: 2.0 + >Status: Closed >Resolution: Accepted >Priority: 4 Submitted By: Dan Bernier (danbernier) Assigned to: Nobody (None) Summary: Stackable.peek REMOVES last item, like pop Initial Comment: Stackable's peek modifies the underlying array, acting like pop. In fact, the methods are implemented the same way, using splice(-1). Attached is a file that demonstrates the problem, and provides a fix. ---------------------------------------------------------------------- >Comment By: 7rans (transami) Date: 2008-02-23 15:54 Message: Thanks for the bug report! That was supposed to be slice(-1), rather then splice(-1). I've fixed. ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=3169&aid=18300&group_id=804