Module: FunRuby::String

Extended by:
String
Includes:
Common::Helpers
Included in:
String
Defined in:
lib/fun_ruby/string.rb

Overview

Module containing methods for strings

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.concat(first = F._, second = F._) ⇒ ::String

Concats a string by a passed delimiter

Examples:

Basics

F::String.concat("123", "456") #=> "123456"

Curried

curried = F::String.concat
curried.("123").("456") #=> "123456"

Curried with placeholder

curried = F::String.concat(F._, "456")
curried.("123") #=> "123456"

Parameters:

  • first (::String) (defaults to: F._)
  • second (::String) (defaults to: F._)

Returns:

  • (::String)

Since:

  • 0.1.0



54
55
56
# File 'lib/fun_ruby/string.rb', line 54

def concat(first = F._, second = F._)
  curry_implementation(:concat, first, second)
end

.split(splitter = F._, string = F._) ⇒ ::Array[::String]

Split a string by a passed delimiter

Examples:

Basics

F::String.split("+", "1+2+3") #=> ["1", "2", "3"]

Curried

curried = F::String.split
curried.("+").("1+2+3") #=> ["1", "2", "3"]

Curried with placeholder

curried = F::String.split(F._, "1+2+3")
curried.("+") #=> ["1", "2", "3"]

Parameters:

  • splitter (::Array|::Regexp) (defaults to: F._)
  • string (::String) (defaults to: F._)

Returns:

  • (::Array[::String])

Since:

  • 0.1.0



31
32
33
# File 'lib/fun_ruby/string.rb', line 31

def split(splitter = F._, string = F._)
  curry_implementation(:split, splitter, string)
end

Instance Method Details

#concat(first = F._, second = F._) ⇒ ::String

Concats a string by a passed delimiter

Examples:

Basics

F::String.concat("123", "456") #=> "123456"

Curried

curried = F::String.concat
curried.("123").("456") #=> "123456"

Curried with placeholder

curried = F::String.concat(F._, "456")
curried.("123") #=> "123456"

Parameters:

  • first (::String) (defaults to: F._)
  • second (::String) (defaults to: F._)

Returns:

  • (::String)

Since:

  • 0.1.0



54
55
56
# File 'lib/fun_ruby/string.rb', line 54

def concat(first = F._, second = F._)
  curry_implementation(:concat, first, second)
end

#split(splitter = F._, string = F._) ⇒ ::Array[::String]

Split a string by a passed delimiter

Examples:

Basics

F::String.split("+", "1+2+3") #=> ["1", "2", "3"]

Curried

curried = F::String.split
curried.("+").("1+2+3") #=> ["1", "2", "3"]

Curried with placeholder

curried = F::String.split(F._, "1+2+3")
curried.("+") #=> ["1", "2", "3"]

Parameters:

  • splitter (::Array|::Regexp) (defaults to: F._)
  • string (::String) (defaults to: F._)

Returns:

  • (::Array[::String])

Since:

  • 0.1.0



31
32
33
# File 'lib/fun_ruby/string.rb', line 31

def split(splitter = F._, string = F._)
  curry_implementation(:split, splitter, string)
end