Array splitting

Hi
ri Array#split # yes, it exists

require 'active_support' # => 5.0.1 ok
[1,2,3].split 2 # no method

Did I miss something?

thanks
Opti

Hi
ri Array#split # yes, it exists

commes from 'facets' gem, not plain ruby

require 'active_support'

=> true

Array.split 2

NoMethodError: undefined method `split' for Array:Class
  from (irb):2
  from /bin/irb:11:in `<main>'

[1,2,3].split 2

NoMethodError: undefined method `split' for [1, 2, 3]:Array
  from (irb):3
  from /bin/irb:11:in `<main>'

require 'facets'

=> true

[1,2,3].split 2

=> [[1], [3]]

···

On 01/20/2017 01:58 PM, Die Optimisten wrote:

$ ri Array#split
Nothing known about Array#split

···

On Fri, Jan 20, 2017 at 3:58 PM, Die Optimisten <inform@die-optimisten.net> wrote:

Hi
ri Array#split # yes, it exists

require 'active_support' # => 5.0.1 ok
[1,2,3].split 2 # no method

Did I miss something?

thanks
Opti

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk&gt;

# Depends which gems are installed:

ri Array#split
         (from gem activesupport-5.0.1)
         === Implementation from Array

···

On 2017-01-20 14:05, Ralf Mueller wrote:

On 01/20/2017 01:58 PM, Die Optimisten wrote:

Hi ri Array#split # yes, it exists

commes from 'facets' gem, not plain ruby

------------------------------------------------------------------------------
         split(value = nil)
         ...

So I need someone having this gem...

require 'active_support' # => 5.0.1 ok
[1,2,3].split 2 # no method

Did I miss something?

thanks
Opti

Hi ri Array#split # yes, it exists

commes from 'facets' gem, not plain ruby

# Depends which gems are installed:

ri Array#split
        (from gem activesupport-5.0.1)
        === Implementation from Array
------------------------------------------------------------------------------
        split(value = nil)
        ...

So I need someone having this gem...

require 'active_support' # => 5.0.1 ok
[1,2,3].split 2 # no method

Did I miss something?

require 'active_support/core_ext/array/grouping'

=> true

.split 2

=> []

[1,2,3,4,5,6,7].split 2

=> [[1], [3, 4, 5, 6, 7]]

···

On 01/20/2017 02:16 PM, Die Optimisten wrote:

On 2017-01-20 14:05, Ralf Mueller wrote:

On 01/20/2017 01:58 PM, Die Optimisten wrote:

the doc: http://edgeguides.rubyonrails.org/active_support_core_extensions.html

···

On 01/20/2017 02:16 PM, Die Optimisten wrote:

On 2017-01-20 14:05, Ralf Mueller wrote:

On 01/20/2017 01:58 PM, Die Optimisten wrote:

Hi ri Array#split # yes, it exists

commes from 'facets' gem, not plain ruby

# Depends which gems are installed:

ri Array#split
        (from gem activesupport-5.0.1)
        === Implementation from Array
------------------------------------------------------------------------------
        split(value = nil)
        ...

So I need someone having this gem...

require 'active_support' # => 5.0.1 ok
[1,2,3].split 2 # no method

Did I miss something?

Ok!
From where can I know this? (where to find that?)
And: why did it work for you, using only require 'activesupport' ?

thanks
Opti

···

On 2017-01-20 14:33, Ralf Mueller wrote:

require 'active_support/core_ext/array/grouping'

require 'active_support/core_ext/array/grouping'

Ok!
From where can I know this? (where to find that?)

first search results for 'active_support array extension'

And: why did it work for you, using only require 'activesupport' ?

no, it did not (see my first reply).

cheers
ralf

···

On 01/20/2017 02:40 PM, Die Optimisten wrote:

On 2017-01-20 14:33, Ralf Mueller wrote:

require 'active_support/core_ext/array/grouping'

[...]

And: why did it work for you, using only require 'activesupport' ?

No, it worked with

  require 'active_support/core_ext/array/grouping'

which is _not_ the same as require 'activesupport'.
(which wouldn't work at all).

Regards,
Marcus

···

Am 20.01.2017 um 14:40 schrieb Die Optimisten:

On 2017-01-20 14:33, Ralf Mueller wrote:

--
GitHub: https://github.com/stomar/
PGP: 0x6B3A101A

I got your mail with the doc-link after I sent that, my question was concerning

your previous reply require 'active_support/core_ext/array/grouping'

Thanks!
Opti

···

On 2017-01-20 14:49, Ralf Mueller wrote:

require 'active_support/core_ext/array/grouping'

Ok!
From where can I know this? (where to find that?)

first search results for 'active_support array extension'

ah, thats why - sorry for the misunderstanding. I have to remember, that good old email is not a chat-system :wink:

best
ralf

···

On 01/20/2017 02:53 PM, Die Optimisten wrote:

On 2017-01-20 14:49, Ralf Mueller wrote:

require 'active_support/core_ext/array/grouping'

Ok!
From where can I know this? (where to find that?)

first search results for 'active_support array extension'

I got your mail with the doc-link after I sent that, my question was concerning

your previous reply require 'active_support/core_ext/array/grouping'