From noreply at rubyforge.org Thu Nov 1 22:44:22 2007 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Thu, 1 Nov 2007 22:44:22 -0400 (EDT) Subject: [Facets] [ facets-Patches-15277 ] Enhanced Module::attr_accessor and Module::attr_reader supporting default values Message-ID: <20071102024422.26E6E18585D7@rubyforge.org> Patches item #15277, was opened at 2007-11-01 21:44 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=3171&aid=15277&group_id=804 Category: None Group: None Status: Open Resolution: None Priority: 3 Submitted By: Nils Jonsson (njonsson) Assigned to: Nobody (None) Summary: Enhanced Module::attr_accessor and Module::attr_reader supporting default values Initial Comment: This is a backwards-compatible enhancement to Module::attr_accessor and Module::attr_reader. They accept a hash of attribute names with default values of those attributes. That is to say, you can specify a value for an attribute that it will have until you set it to something else. If the default value is a Proc then the Proc is called in order to obtain a default value. This kind of thing is useful in dependency-injection scenarios. The default value of an attribute represents a runtime dependency value. At test-time, the value can be set to a mock value. Note that the normal behavior of attr_accessor and attr_reader is still supported. The hash attributes are optional. ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=3171&aid=15277&group_id=804 From noreply at rubyforge.org Fri Nov 23 08:04:37 2007 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Fri, 23 Nov 2007 08:04:37 -0500 (EST) Subject: [Facets] [ facets-Bugs-15864 ] Error instaling facets-2.1.2.gem Message-ID: <20071123130437.80BE4185864F@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: None Group: None Status: Open Resolution: None Priority: 3 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 ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=3169&aid=15864&group_id=804 From transfire at gmail.com Fri Nov 23 08:58:01 2007 From: transfire at gmail.com (Trans) Date: Fri, 23 Nov 2007 05:58:01 -0800 (PST) Subject: [Facets] [ facets-Bugs-15864 ] Error instaling facets-2.1.2.gem In-Reply-To: <20071123130437.80BE4185864F@rubyforge.org> References: <20071123130437.80BE4185864F@rubyforge.org> Message-ID: On Nov 23, 8:04 am, wrote: > 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_i... > > Category: None > Group: None > Status: Open > Resolution: None > Priority: 3 > 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 Thanks for the report. I'm not having problems with it, so my first thought, is whether this to do with the recent RubyGems update. What version of RubyGems are you running? Also what OS? Thanks, T. From noreply at rubyforge.org Fri Nov 23 22:41:46 2007 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Fri, 23 Nov 2007 22:41:46 -0500 (EST) Subject: [Facets] [ facets-Bugs-15864 ] Error instaling facets-2.1.2.gem Message-ID: <20071124034146.1F5031858646@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: Open 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-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 Tue Nov 27 19:18:01 2007 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Tue, 27 Nov 2007 19:18:01 -0500 (EST) Subject: [Facets] [ facets-Bugs-15981 ] Enumerable#collate has unexpected results Message-ID: <20071128001801.A7F00185865C@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: Open 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? ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=3169&aid=15981&group_id=804 From noreply at rubyforge.org Tue Nov 27 19:32:49 2007 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Tue, 27 Nov 2007 19:32:49 -0500 (EST) Subject: [Facets] [ facets-Bugs-15981 ] Enumerable#collate has unexpected results Message-ID: <20071128003249.2FA3B1858669@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: Open 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: 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 Tue Nov 27 22:50:08 2007 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Tue, 27 Nov 2007 22:50:08 -0500 (EST) Subject: [Facets] [ facets-Bugs-15981 ] Enumerable#collate has unexpected results Message-ID: <20071128035008.F415418585FC@rubyforge.org> Bugs item #15981, was opened at 2007-11-27 19:18 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=3169&aid=15981&group_id=804 Category: None Group: None Status: Open 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: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 19: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 Tue Nov 27 23:33:19 2007 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Tue, 27 Nov 2007 23:33:19 -0500 (EST) Subject: [Facets] [ facets-Bugs-15981 ] Enumerable#collate has unexpected results Message-ID: <20071128043319.B30C718585C5@rubyforge.org> Bugs item #15981, was opened at 2007-11-27 19:18 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=3169&aid=15981&group_id=804 Category: None Group: None Status: Open 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 23: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 22: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 19: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 transfire at gmail.com Wed Nov 28 18:05:42 2007 From: transfire at gmail.com (Trans) Date: Wed, 28 Nov 2007 15:05:42 -0800 (PST) Subject: [Facets] [ facets-Bugs-15864 ] Error instaling facets-2.1.2.gem In-Reply-To: <20071124034146.1F5031858646@rubyforge.org> References: <20071124034146.1F5031858646@rubyforge.org> Message-ID: <7424993d-5029-45e5-9829-aa055622f414@n20g2000hsh.googlegroups.com> Lets see if 2.1.3 does the trick. T.