Module: FunRuby::Array

Extended by:
Array
Includes:
Common::Helpers
Included in:
Array
Defined in:
lib/fun_ruby/array.rb

Overview

Module containing methods for arrays

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.join(string = F._, array = F._) ⇒ String

Returns a string built from elements joined by a given string

Examples:

Basics

ary = [1, 2, 3]
F::Array.join("+", ary) # => "1+2+3"

Parameters:

  • string (String) (defaults to: F._)
  • array (::Array) (defaults to: F._)

Returns:

Since:

  • 0.1.0



45
46
47
# File 'lib/fun_ruby/array.rb', line 45

def join(string = F._, array = F._)
  curry_implementation(:join, string, array)
end

.size(array = F._) ⇒ Integer

Returns a size of array

Examples:

Basics

F::Array.size([]) # => 0
F::Array.size([1]) # => 1
F::Array.size([1, 2, 3]) # => 3

Curried

curried = F::Array.size
curried.([1,2,3]) # => 3
curried.([]) # => 0

Parameters:

  • array (::Array) (defaults to: F._)

Returns:

  • (Integer)

Since:

  • 0.1.0



29
30
31
# File 'lib/fun_ruby/array.rb', line 29

def size(array = F._)
  curry_implementation(:size, array)
end

Instance Method Details

#join(string = F._, array = F._) ⇒ String

Returns a string built from elements joined by a given string

Examples:

Basics

ary = [1, 2, 3]
F::Array.join("+", ary) # => "1+2+3"

Parameters:

  • string (String) (defaults to: F._)
  • array (::Array) (defaults to: F._)

Returns:

Since:

  • 0.1.0



45
46
47
# File 'lib/fun_ruby/array.rb', line 45

def join(string = F._, array = F._)
  curry_implementation(:join, string, array)
end

#size(array = F._) ⇒ Integer

Returns a size of array

Examples:

Basics

F::Array.size([]) # => 0
F::Array.size([1]) # => 1
F::Array.size([1, 2, 3]) # => 3

Curried

curried = F::Array.size
curried.([1,2,3]) # => 3
curried.([]) # => 0

Parameters:

  • array (::Array) (defaults to: F._)

Returns:

  • (Integer)

Since:

  • 0.1.0



29
30
31
# File 'lib/fun_ruby/array.rb', line 29

def size(array = F._)
  curry_implementation(:size, array)
end