From: Timothy Gregory Date: 2013-02-08T13:01:10+09:00 Subject: Re: Issues from an extreme beginner --20cf303b3fbfe44eb804d52e9bde Content-Type: text/plain; charset=ISO-8859-1 hay that is concise and explicit many thanks now i am reading docs about //inflections.rb i grasp your steps under the heading "String inflections define new methods on the String class" where '../inflections.rb' has fifteen methods your solution shows some neat ways it can be adapted in our case both numbers and strings are in singular and plural thankfully the output grammar can be corrected to suit either alternative this was a hitch that is solved in ruby it appears quite a fiddly issue more than it really is On Fri, Feb 8, 2013 at 11:10 AM, Hassan Schroeder < hassan.schroeder@gmail.com> wrote: > On Thu, Feb 7, 2013 at 3:40 PM, Timothy Gregory wrote: > > on the side-track in case the name has only one character then the word > > 'character' is usually written as character(s) rather than as an > apostrophe > > this visible abbreviation is a valid way to create two options. > > to write it this way will (s) need to be escaped? > > for singular and plural to be viable alternatives? > > can (s) be escaped by either "\(s)" or " " ? > > puts needs singular and plural pronouns and tense > > to print 'there is one ,,' or else put 'there are..' > > In a pry console, including one Rails file: > > 1.9.3 (main):0 > require 'active_support/core_ext/string/inflections' > => true > 1.9.3 (main):0 > count = 1 > => 1 > 1.9.3 (main):0 > "there #{'is'.pluralize(count)} #{count} > #{'character'.pluralize(count)}." > => "there is 1 character." > 1.9.3 (main):0 > count = 3 > => 3 > 1.9.3 (main):0 > "there #{'is'.pluralize(count)} #{count} > #{'character'.pluralize(count)}." > => "there is 3 characters." > > !! oops, that's a surprising omission, but > > 1.9.3 (main):0 > ActiveSupport::Inflector.inflections{|inflect| > inflect.plural "is", "are" } > .... > 1.9.3 (main):0 > "there #{'is'.pluralize(count)} #{count} > #{'character'.pluralize(count)}." > => "there are 3 characters." > > HTH, > -- > Hassan Schroeder ------------------------ hassan.schroeder@gmail.com > http://about.me/hassanschroeder > twitter: @hassan > > --20cf303b3fbfe44eb804d52e9bde Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
=A0hay that is concise and explicit many thanks =
=A0now i am reading docs about //inflections.rb=A0
i grasp your ste= ps under the heading
"String inflections define new methods o= n the String class"
where '../inflections.rb' has fifteen methods
your solution sho= ws some neat ways it can be adapted
in our case both numbers and strings= are in singular and plural
thankfully the output grammar can be correc= ted to suit either alternative
this was a hitch that is solved in ruby
it appears quite a fiddly= issue more than it really is


=
On Fri, Feb 8, 2013 at 11:10 AM, Hassan Schroede= r <hassan.schroeder@gmail.com> wrote:
On Thu, Feb 7, 2013 at 3:4= 0 PM, Timothy Gregory <tigre7t@gmai= l.com> wrote:
> on the side-track in case the name has only one character then the wor= d
> 'character' is usually written as character(s) rather than as = an apostrophe
> this visible abbreviation is a valid way to create two options.
> to write it this way will (s) need to be escaped?
> for singular and plural to be viable alternatives?
> can (s) be escaped by either "\(s)" or " " ?
> puts needs singular and plural pronouns and tense
> to print 'there is one ,,' or else put 'there are..'
In a pry console, including one Rails file:

1.9.3 (main):0 > require 'active_support/core_ext/string/inflections= '
=3D> true
1.9.3 (main):0 > count =3D 1
=3D> 1
1.9.3 (main):0 > "there #{'is'.pluralize(count)} #{count} #{'character'.pluralize(count)}."
=3D> "there is 1 character."
1.9.3 (main):0 > count =3D 3
=3D> 3
1.9.3 (main):0 > "there #{'is'.pluralize(count)} #{count} #{'character'.pluralize(count)}."
=3D> "there is 3 characters."

!! oops, that's a surprising omission, but

1.9.3 (main):0 > ActiveSupport::Inflector.inflections{|inflect|
inflect.plural "is", "are" }
....
1.9.3 (main):0 > "there #{'is'.pluralize(count)} #{count} #{'character'.pluralize(count)}."
=3D> "there are 3 characters."

HTH,
--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
http://about.= me/hassanschroeder
twitter: @hassan


--20cf303b3fbfe44eb804d52e9bde--