From: Peter Hickman Date: 2013-02-24T05:14:59+09:00 Subject: Re: why "Range" not worked on "to_ary" ? --047d7b343e8a374b0204d669f6b9 Content-Type: text/plain; charset=ISO-8859-1 Try looking at the methods available to a Range. $ irb irb(main):001:0> a = (1..9) => 1..9 irb(main):002:0> a.public_methods.sort => ["==", "===", "=~", "__id__", "__send__", "all?", "any?", "begin", "class", "clone", "collect", "count", "cycle", "detect", "display", "drop", "drop_while", "dup", "each", "each_cons", "each_slice", "each_with_index", "end", "entries", "enum_cons", "enum_for", "enum_slice", "enum_with_index", "eql?", "equal?", "exclude_end?", "extend", "find", "find_all", "find_index", "first", "freeze", "frozen?", "grep", "group_by", "hash", "id", "include?", "inject", "inspect", "instance_eval", "instance_exec", "instance_of?", "instance_variable_defined?", "instance_variable_get", "instance_variable_set", "instance_variables", "is_a?", "kind_of?", "last", "map", "max", "max_by", "member?", "method", "methods", "min", "min_by", "minmax", "minmax_by", "nil?", "none?", "object_id", "one?", "partition", "private_methods", "protected_methods", "public_methods", "reduce", "reject", "respond_to?", "reverse_each", "select", "send", "singleton_methods", "sort", "sort_by", "step", "taguri", "taguri=", "taint", "tainted?", "take", "take_while", "tap", "to_a", "to_enum", "to_s", "to_yaml", "to_yaml_properties", "to_yaml_style", "type", "untaint", "zip"] And there we have it to_a --047d7b343e8a374b0204d669f6b9 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Try looking at the methods available to a Range.
<= /div>

$ irb
irb(main):001:0&= gt; a =3D (1..9)
=3D> 1..9
irb= (main):002:0> a.public_methods.sort
=3D&= gt; ["=3D=3D", "=3D=3D=3D", "=3D~", "__i= d__", "__send__", "all?", "any?", "= begin", "class", "clone", "collect", &qu= ot;count", "cycle", "detect", "display",= "drop", "drop_while", "dup", "each"= ;, "each_cons", "each_slice", "each_with_index&quo= t;, "end", "entries", "enum_cons", "enum= _for", "enum_slice", "enum_with_index", "eql?= ", "equal?", "exclude_end?", "extend", &= quot;find", "find_all", "find_index", "first&= quot;, "freeze", "frozen?", "grep", "gro= up_by", "hash", "id", "include?", "= inject", "inspect", "instance_eval", "instanc= e_exec", "instance_of?", "instance_variable_defined?&qu= ot;, "instance_variable_get", "instance_variable_set", = "instance_variables", "is_a?", "kind_of?", &q= uot;last", "map", "max", "max_by", "= ;member?", "method", "methods", "min", &= quot;min_by", "minmax", "minmax_by", "nil?&qu= ot;, "none?", "object_id", "one?", "part= ition", "private_methods", "protected_methods", &q= uot;public_methods", "reduce", "reject", "res= pond_to?", "reverse_each", "select", "send&qu= ot;, "singleton_methods", "sort", "sort_by", = "step", "taguri", "taguri=3D", "taint&qu= ot;, "tainted?", "take", "take_while", "= tap", "to_a", "to_enum", "to_s", "t= o_yaml", "to_yaml_properties", "to_yaml_style", &q= uot;type", "untaint", "zip"]

And t= here we have it to_a

=
--047d7b343e8a374b0204d669f6b9--