From transfire at gmail.com Thu Dec 6 23:25:03 2007 From: transfire at gmail.com (Trans) Date: Thu, 6 Dec 2007 20:25:03 -0800 (PST) Subject: [Facets] Lazy.rb in core? Message-ID: Should MenTaLguY's lazy.rb be part of the core? Ie. Should be loaded automatically with require 'facets' Since 2.0 I've been providing it that way, even though the lib itself is still sitting in the more/ directory. Either I need to move it to core/ or not have it loaded as part of the core set of functionality. Anyone have an opinion on this? T. From noreply at rubyforge.org Thu Dec 13 14:52:04 2007 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Thu, 13 Dec 2007 14:52:04 -0500 (EST) Subject: [Facets] [ facets-Bugs-16293 ] Summary in metadata is blank Message-ID: <20071213195204.AF37B18585D3@rubyforge.org> Bugs item #16293, was opened at 2007-12-13 13:52 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=3169&aid=16293&group_id=804 Category: Insallation Group: None Status: Open Resolution: None Priority: 3 Submitted By: Andrew Dudzik (adudzik) Assigned to: Nobody (None) Summary: Summary in metadata is blank Initial Comment: On line 8 of the packaged gem metadata, we have: summary: "" Shouldn't Facets have a more confident image? ;) Seriously, given that it's a required field for GemSpec, it should be filled in. It's actually breaking an internal gem deployment system that I'm using. I'm really not sure how to describe Facets, so I don't have any good suggestions. (sorry!) ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=3169&aid=16293&group_id=804 From noreply at rubyforge.org Thu Dec 13 14:53:38 2007 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Thu, 13 Dec 2007 14:53:38 -0500 (EST) Subject: [Facets] [ facets-Bugs-15981 ] Enumerable#collate has unexpected results Message-ID: <20071213195338.6822018585D4@rubyforge.org> Bugs item #15981, was opened at 2007-11-27 18:18 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=3169&aid=15981&group_id=804 Category: None Group: None >Status: Closed Resolution: None Priority: 3 Submitted By: Andrew Dudzik (adudzik) Assigned to: Nobody (None) Summary: Enumerable#collate has unexpected results Initial Comment: * It seems to me that [[],[]].collate should return {[]=>[]}, but it returns {}. This seems to be a consequence of the use of flatten!. * Also, [[]].collate{ |x| [x,x] } should return {[]=>[]}, but returns {nil=>nil}. (this seems to be a similar problem, but is not fixed by removing flatten) * Here is my proposed fix: module Enumerable def collate(&yld) if yld inject({}) do |h, *kv| # Used to be inject({}) do |h,kv| nk, nv = *yld[*kv].to_a # Used to be nk, nv = *yld[*kv].to_a.flatten h[nk] = nv h end else Hash[*self.to_a] # Used to be Hash[*self.to_a.flatten] end end end * Caveats: Note that this will change the behavior of e.g. [[1,2]].collate; instead of returning {1=>2}, it will throw an ArgumentError. But in my opinion, if collate is being used in this way, the user should instead call flatten.collate. This will also break the behavior of collate on hashes. If we *really* want to maintain that, we can do it explicitly: class Hash def collate(&yld) to_a.flatten.collate(&yld) end end Is there a method that we can use besides flatten in these situations, that is not recursive--this is to say, which only goes one level deep? ---------------------------------------------------------------------- Comment By: 7rans (transami) Date: 2007-11-27 22:33 Message: I'm thinking this is a little more appropriate now: def collate(&yld) if yld inject({}) do |h, *kv| nk, nv = *yld[*kv].to_a h[nk] = nv h end else Enumerator.new(self,:collate) end end ---------------------------------------------------------------------- Comment By: 7rans (transami) Date: 2007-11-27 21:50 Message: Thanks for catching this. Using Hash[*enum.to_a.flatten] is a pattern I've mistakenly used a few times. Hopefully we've gotten them all now, but I'll have to do a grep and make sure. I think we can use your version of collate as is. The blockless Hash case was a null-op anyway, so it's better to have it do something different rather than nothing at all. ---------------------------------------------------------------------- Comment By: Andrew Dudzik (adudzik) Date: 2007-11-27 18:32 Message: I suppose that inject won't be taking more than 2 block parameters any time soon, so both splats are unnecessary: inject({}) do |h, kv| # Used to be inject({}) do |h,kv| nk, nv = *yld[kv].to_a # Used to be nk, nv = *yld[*kv].to_a.flatten ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=3169&aid=15981&group_id=804 From noreply at rubyforge.org Thu Dec 13 15:08:27 2007 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Thu, 13 Dec 2007 15:08:27 -0500 (EST) Subject: [Facets] [ facets-Bugs-16293 ] Summary in metadata is blank Message-ID: <20071213200827.718811978491@rubyforge.org> Bugs item #16293, was opened at 2007-12-13 14:52 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=3169&aid=16293&group_id=804 Category: Insallation Group: None >Status: Closed Resolution: None Priority: 3 Submitted By: Andrew Dudzik (adudzik) Assigned to: Nobody (None) Summary: Summary in metadata is blank Initial Comment: On line 8 of the packaged gem metadata, we have: summary: "" Shouldn't Facets have a more confident image? ;) Seriously, given that it's a required field for GemSpec, it should be filled in. It's actually breaking an internal gem deployment system that I'm using. I'm really not sure how to describe Facets, so I don't have any good suggestions. (sorry!) ---------------------------------------------------------------------- >Comment By: 7rans (transami) Date: 2007-12-13 15:08 Message: Ah, thanks. My gem generator script used to treat "subtitle" and "summary" as aliases. I recently changed it so they were different fields, so that's how the summary got lost. I just fixed it and re-upload 2.2.0 gem. Thanks for catching this! ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=3169&aid=16293&group_id=804 From noreply at rubyforge.org Thu Dec 13 15:09:08 2007 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Thu, 13 Dec 2007 15:09:08 -0500 (EST) Subject: [Facets] [ facets-Bugs-15864 ] Error instaling facets-2.1.2.gem Message-ID: <20071213200908.65F46197848E@rubyforge.org> Bugs item #15864, was opened at 2007-11-23 08:04 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=3169&aid=15864&group_id=804 Category: Insallation Group: None >Status: Closed Resolution: None Priority: 5 Submitted By: Nobody (None) Assigned to: Nobody (None) Summary: Error instaling facets-2.1.2.gem Initial Comment: U:...> gem install facets-2.1.2.gem ERROR: While executing gem ... (RuntimeError) Error instaling facets-2.1.2.gem: invalid gem format for facets-2.1.2.gem ---------------------------------------------------------------------- >Comment By: 7rans (transami) Date: 2007-12-13 15:09 Message: Well, here's to hoping 2.2.0 has put this to rest. Let me know if it has not. Thanks. ---------------------------------------------------------------------- Comment By: 7rans (transami) Date: 2007-11-23 22:41 Message: I'm not having issues with it. I wonder if this has something to do with the latest release of RubyGems, which I have not upgraded to yet. What version of RubyGems are you running? And what OS are you on. Thanks. ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=3169&aid=15864&group_id=804 From noreply at rubyforge.org Thu Dec 13 15:10:50 2007 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Thu, 13 Dec 2007 15:10:50 -0500 (EST) Subject: [Facets] [ facets-Bugs-11396 ] certain facets-1.7.46 classes break rtags Message-ID: <20071213201051.1447B1978494@rubyforge.org> Bugs item #11396, was opened at 2007-06-06 10:34 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=3169&aid=11396&group_id=804 >Category: Documentation >Group: 1.0 - 2.0 >Status: Closed Resolution: None Priority: 1 Submitted By: Nobody (None) Assigned to: Nobody (None) Summary: certain facets-1.7.46 classes break rtags Initial Comment: I wanted to create a TAGS file so I could quickly reference the source for my facets gem. However, rtags appears to hang/loop on any file that contains the following snippet: # _____ _ # |_ _|__ ___| |_ # | |/ _ \/ __| __| # | | __/\__ \ |_ # |_|\___||___/\__| # =begin test ... =end ---------------------------------------------------------------------- >Comment By: 7rans (transami) Date: 2007-12-13 15:10 Message: All of these ASCII art headers should now be gone as of 2.2.0 (or soon will be if I've missed any). So this will no longer be of any consequence. ---------------------------------------------------------------------- Comment By: 7rans (transami) Date: 2007-07-26 03:34 Message: I've considered alternatives to this demarcation. It helps me immediately know when the code is done and the test begins, though I realize it is rather extraneous. But I have yet to come up with a better alternative. However, that doesn't seem to be the real issue. I see that you submitted a bug report to rtags project too. Glad to see it, as I was going to suggest it. In the report you mention that removing the =begin and =end fixes it. So it seems the bug is squarely with rtags. Any word of them addressing this yet? I'll try following up with them. And I'll keep this ticket open until it's resolved. Thanks. ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=3169&aid=11396&group_id=804 From noreply at rubyforge.org Thu Dec 13 15:12:02 2007 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Thu, 13 Dec 2007 15:12:02 -0500 (EST) Subject: [Facets] [ facets-Bugs-16293 ] Summary in metadata is blank Message-ID: <20071213201202.8FFFA18585E2@rubyforge.org> Bugs item #16293, was opened at 2007-12-13 13:52 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=3169&aid=16293&group_id=804 Category: Insallation Group: None Status: Closed Resolution: None Priority: 3 Submitted By: Andrew Dudzik (adudzik) Assigned to: Nobody (None) Summary: Summary in metadata is blank Initial Comment: On line 8 of the packaged gem metadata, we have: summary: "" Shouldn't Facets have a more confident image? ;) Seriously, given that it's a required field for GemSpec, it should be filled in. It's actually breaking an internal gem deployment system that I'm using. I'm really not sure how to describe Facets, so I don't have any good suggestions. (sorry!) ---------------------------------------------------------------------- >Comment By: Andrew Dudzik (adudzik) Date: 2007-12-13 14:12 Message: As an example, the summary in the Rails gem metadata is: "Web-application framework with template engine, control-flow layer, and ORM." ---------------------------------------------------------------------- Comment By: 7rans (transami) Date: 2007-12-13 14:08 Message: Ah, thanks. My gem generator script used to treat "subtitle" and "summary" as aliases. I recently changed it so they were different fields, so that's how the summary got lost. I just fixed it and re-upload 2.2.0 gem. Thanks for catching this! ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=3169&aid=16293&group_id=804 From jackc at hylesanderson.edu Wed Dec 19 17:38:48 2007 From: jackc at hylesanderson.edu (Jack Christensen) Date: Wed, 19 Dec 2007 16:38:48 -0600 Subject: [Facets] Unable to use facets/string/format Message-ID: <47699D78.3050801@hylesanderson.edu> Even though it says loading facets/string/format works the methods are unavailable. irb(main):001:0> require 'facets/string/format' => true irb(main):002:0> "This is a big long string to be word wrapped".word_wrap(10) NoMethodError: undefined method `word_wrap' for "This is a big long string to be word wrapped":String from (irb):2 If I directly load the file it works. irb(main):001:0> require 'C:\ruby\lib\ruby\gems\1.8\gems\facets-2.2.0\lib\core\facets\string\format.rb' => true irb(main):002:0> "This is a big long string to be word wrapped".word_wrap(10) => "This is a\nbig long\nstring to\nbe word\nwrapped\n" I've tried this on multiple computers and with a fresh install of ruby one-click with no change. Am I totally missing something or is there a bug here? -- Jack Christensen jackc at hylesanderson.edu From transfire at gmail.com Wed Dec 19 23:16:56 2007 From: transfire at gmail.com (Trans) Date: Wed, 19 Dec 2007 20:16:56 -0800 (PST) Subject: [Facets] Unable to use facets/string/format In-Reply-To: <47699D78.3050801@hylesanderson.edu> References: <47699D78.3050801@hylesanderson.edu> Message-ID: <1656378a-c6c6-49bf-b900-1ed24320d00b@b40g2000prf.googlegroups.com> Jack Christensen wrote: > Even though it says loading facets/string/format works the methods are > unavailable. > > irb(main):001:0> require 'facets/string/format' > => true > irb(main):002:0> "This is a big long string to be word > wrapped".word_wrap(10) > NoMethodError: undefined method `word_wrap' for "This is a big long > string to be word wrapped":String > from (irb):2 > > If I directly load the file it works. > > irb(main):001:0> require > 'C:\ruby\lib\ruby\gems\1.8\gems\facets-2.2.0\lib\core\facets\string\format.rb' > => true > irb(main):002:0> "This is a big long string to be word > wrapped".word_wrap(10) > => "This is a\nbig long\nstring to\nbe word\nwrapped\n" > > I've tried this on multiple computers and with a fresh install of ruby > one-click with no change. > > Am I totally missing something or is there a bug here? Thanks for the report. Something is odd b/c for me: irb(main):001:0> require 'facets/string/format' => true irb(main):002:0> "blah".word_wrap => "blah\n" Ok... I. figured out why. When using RubyGems (I'm using Rolls, btw) methods/facets/string/format.rb is being loaded instead of core/facets/ string/format.rb. I have a name clash between a categorically named require and a per-method require. I thought I had resolved all these, but now I see that it still arises in certain cases. I'll have to think about how best to resolve this. Thanks again for this report. I'm going to sit down tomorrow and resolve this once and for all. T. From noreply at rubyforge.org Fri Dec 28 12:04:33 2007 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Fri, 28 Dec 2007 12:04:33 -0500 (EST) Subject: [Facets] [ facets-Feature Requests-16675 ] require with * in kernel Message-ID: <20071228170433.97E651858660@rubyforge.org> Feature Requests item #16675, was opened at 2007-12-28 18:04 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=3172&aid=16675&group_id=804 Category: None Group: None Status: Open Priority: 3 Submitted By: Tomaso Tosolini (tomaso_tosolini) Assigned to: Nobody (None) Summary: require with * in kernel Initial Comment: # Hi All, # sometimes it happens to me that i have to require all the files # of a directory, so i changed slightly the require kernel # method. Here follows the code: module Kernel alias_method :simple_require, :require # This version of require is intendended to be NOT recursive and # not able to select only some files in a directory. # -- implemented by Tomaso Tosolini (tomaso.tosolini at gmail) -- def require(s) return if s =~ /\/\*$/ # this is the extended version of require result = true $LOAD_PATH.each do |lp| Dir[File.join(lp, s)].each do |f| result = result && simple_require(f) end end result else simple_require(s) # this is the standard require end end end # Hope you like this. # Bye # # # # # # Tom # ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=3172&aid=16675&group_id=804 From noreply at rubyforge.org Fri Dec 28 12:20:48 2007 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Fri, 28 Dec 2007 12:20:48 -0500 (EST) Subject: [Facets] [ facets-Feature Requests-16676 ] array homogeneous? Message-ID: <20071228172048.85F04185860A@rubyforge.org> Feature Requests item #16676, was opened at 2007-12-28 18:20 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=3172&aid=16676&group_id=804 Category: None Group: None Status: Open Priority: 3 Submitted By: Tomaso Tosolini (tomaso_tosolini) Assigned to: Nobody (None) Summary: array homogeneous? Initial Comment: Hi again, often i need to check wheter all the elements of an array satisfy a condition. Example check that all elements are Integer and are contained in the interval between 1 and 4 Here follows the code: class Array def homogeneous?(test=nil) if test.nil? then # in this case the only thing we can check is whether all elements are of the same type if self.size == 0 then return true else test = self[0].class end end has_block = block_given? for i in 0...self.size return false if !self[i].is_a?(test) || ( has_block && !(yield(self[i])) ) end return true end end the previous example becomes a.homogeneous? { |x| x.is_a?(Integer) && ( 1<=x ) && (x<=4) } Bye Tom ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=3172&aid=16676&group_id=804 From transfire at gmail.com Fri Dec 28 13:51:23 2007 From: transfire at gmail.com (Trans) Date: Fri, 28 Dec 2007 10:51:23 -0800 (PST) Subject: [Facets] [ facets-Feature Requests-16676 ] array homogeneous? In-Reply-To: <20071228172048.85F04185860A@rubyforge.org> References: <20071228172048.85F04185860A@rubyforge.org> Message-ID: On Dec 28, 12:20 pm, wrote: > Feature Requests item #16676, was opened at 2007-12-28 18:20 > You can respond by visiting:http://rubyforge.org/tracker/?func=detail&atid=3172&aid=16676&group_i... > > Category: None > Group: None > Status: Open > Priority: 3 > Submitted By: Tomaso Tosolini (tomaso_tosolini) > Assigned to: Nobody (None) > Summary: array homogeneous? > > Initial Comment: > Hi again, > often i need to check wheter all the elements of an array > satisfy a condition. Example check that all elements are > Integer and are contained in the interval between 1 and 4 > Here follows the code: > > class Array > > def homogeneous?(test=nil) > if test.nil? then > # in this case the only thing we can check is whether all elements are of the same type > if self.size == 0 then > return true > else > test = self[0].class > end > end > has_block = block_given? > for i in 0...self.size > return false if !self[i].is_a?(test) || ( has_block && !(yield(self[i])) ) > end > return true > end > > end > > the previous example becomes > a.homogeneous? { |x| x.is_a?(Integer) && ( 1<=x ) && (x<=4) } Hi Tom, Ruby's built-in Array#all? should do the trick. T. From transfire at gmail.com Fri Dec 28 13:52:28 2007 From: transfire at gmail.com (Trans) Date: Fri, 28 Dec 2007 10:52:28 -0800 (PST) Subject: [Facets] [ facets-Feature Requests-16675 ] require with * in kernel In-Reply-To: <20071228170433.97E651858660@rubyforge.org> References: <20071228170433.97E651858660@rubyforge.org> Message-ID: <2c31da21-9d2d-4b58-996f-aac9313861a5@d21g2000prf.googlegroups.com> On Dec 28, 12:04 pm, wrote: > Feature Requests item #16675, was opened at 2007-12-28 18:04 > You can respond by visiting:http://rubyforge.org/tracker/?func=detail&atid=3172&aid=16675&group_i... > > Category: None > Group: None > Status: Open > Priority: 3 > Submitted By: Tomaso Tosolini (tomaso_tosolini) > Assigned to: Nobody (None) > Summary: require with * in kernel > > Initial Comment: > # Hi All, > # sometimes it happens to me that i have to require all the files > # of a directory, so i changed slightly the require kernel > # method. Here follows the code: > > module Kernel > > alias_method :simple_require, :require > > # This version of require is intendended to be NOT recursive and > # not able to select only some files in a directory. > # -- implemented by Tomaso Tosolini (tomaso.tosolini at gmail) -- > def require(s) > > return if s =~ /\/\*$/ > # this is the extended version of require > > result = true > $LOAD_PATH.each do |lp| > Dir[File.join(lp, s)].each do |f| > result = result && simple_require(f) > end > end > result > else > simple_require(s) > # this is the standard require > end > end > > end > > # Hope you like this. So much so that it's already been done ;) require 'facets/kernel/require_all' require_all 'foo/*' T.