Re: [Rails-core] Re: Defining #blank for Array.

2012-07-10 Thread Rafael Mendonça França
Yes, I think everyone uses #blank? on enumerables in its current state, and expect that behavior, because it is well documented. Rafael Mendonça França http://twitter.com/rafaelfranca https://github.com/rafaelfranca On Tue, Jul 10, 2012 at 3:55 PM, Michael Boutros wrote: > Do you think anyone

Re: [Rails-core] Re: Defining #blank for Array.

2012-07-10 Thread Andrés Mejía
I use it. It makes total sense to me. If you have a piece of paper with a list of 10 blank lines, how do you know there are exactly 10 blank lines instead of 3 or 7 or 13? On Tue, Jul 10, 2012 at 1:55 PM, Michael Boutros wrote: > Do you think anyone currently uses #blank? on enumerables in its c

Re: [Rails-core] Re: Defining #blank for Array.

2012-07-10 Thread James Coleman
2012 at 2:55 PM Subject: Re: [Rails-core] Re: Defining #blank for Array. To: rubyonrails-core@googlegroups.com Do you think anyone currently uses #blank? on enumerables in its current state? It doesn't make sense the way it is right now. Imagine a piece of paper with a list of 10 blank lines

Re: [Rails-core] Re: Defining #blank for Array.

2012-07-10 Thread Michael Boutros
Do you think anyone currently uses #blank? on enumerables in its current state? It doesn't make sense the way it is right now. Imagine a piece of paper with a list of 10 blank lines. Wouldn't you call that a blank list? On Monday, July 9, 2012 10:50:34 AM UTC-4, Xavier Noria wrote: > > On Mon, J

Re: [Rails-core] Re: Defining #blank for Array.

2012-07-09 Thread Oscar Del Ben
Blank is a convenience method for not checking the type of object. If you want to do that you should use: array.all?(&:blank) -- Oscar Del Ben Sent with Sparrow (http://www.sparrowmailapp.com/?sig) On Monday, July 9, 2012 at 7:30 AM, Michael Boutros wrote: > Sorry, where I last wrote "empty

[Rails-core] Re: Defining #blank for Array.

2012-07-09 Thread Scott Gonyea
Lock down your data at the gates and this is not a problem. Making #blank? incredibly slow is silly. On Jul 9, 7:15 am, Michael Boutros wrote: > Hello: > > 1.9.3p194 :014 > "".blank? >  => true > 1.9.3p194 :015 > ["", ""].blank? >  => false > > Proposal: the second line should also produce true.

Re: [Rails-core] Re: Defining #blank for Array.

2012-07-09 Thread Oscar Del Ben
That's very unlikely to happen. Pretty much all Rails app rely on this behavior. -- Oscar Del Ben Sent with Sparrow (http://www.sparrowmailapp.com/?sig) On Monday, July 9, 2012 at 7:38 AM, Michael Boutros wrote: > Yes. > > On Monday, July 9, 2012 10:31:30 AM UTC-4, Xavier Noria wrote: > > Ah,

Re: [Rails-core] Re: Defining #blank for Array.

2012-07-09 Thread Xavier Noria
On Mon, Jul 9, 2012 at 4:38 PM, Michael Boutros wrote: Yes. Your implementation makes sense. I mean, I believe that if blank? was defined on enumerables as all?(&:blank?) from the very first day, one could have accepted that definition just fine. But the current definition also makes sense to m

Re: [Rails-core] Re: Defining #blank for Array.

2012-07-09 Thread Michael Boutros
Yes. On Monday, July 9, 2012 10:31:30 AM UTC-4, Xavier Noria wrote: > > Ah, OK. So the definition of blank? is clear but you are proposing to > change it for Arrays right? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To view this di

Re: [Rails-core] Re: Defining #blank for Array.

2012-07-09 Thread Xavier Noria
Ah, OK. So the definition of blank? is clear but you are proposing to change it for Arrays right? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from

[Rails-core] Re: Defining #blank for Array.

2012-07-09 Thread Michael Boutros
https://gist.github.com/3076887 On Monday, July 9, 2012 10:15:04 AM UTC-4, Michael Boutros wrote: > > Hello: > > 1.9.3p194 :014 > "".blank? > => true > 1.9.3p194 :015 > ["", ""].blank? > => false > > Proposal: the second line should also produce true. > > Thoughts? > -- You received this mes

[Rails-core] Re: Defining #blank for Array.

2012-07-09 Thread Michael Boutros
Sorry, where I last wrote "empty" I meant to write "blank," ie: That's why I think an array full of false, empty, or whitespace strings should be _blank_. Rails defines blank as a convenience method instead of checking if something is nil and then if it's empty or not. I think extending that co