Kanrisuru

Util

Kanrisuru::Util is a collection of utility modules and methods used across the Kanrisuru project.

Namespace

Util::Bits

Util::DmiType

Util::FsMountOpts

Util::OsFamily

Util::Signal

Public Class Methods

blank?

Returns true if the argument is empty, nil or no elements in a collection.

Kanrisuru::Util.blank?([])
true

Kanrisuru::Util.blank?(nil)
true

Kanrisuru::Util.blank?("")
true

present?

Returns true if the argument is a collection with elements, a string with characters or another data type that is not nil.

Kanrisuru::Util.present?([1])
true

Kanrisuru::Util.present?(1)
true

Kanrisuru::Util.present?("1")
true

array_join_string

Combines an array type into a string, separated by a field type. Default field is a , character. Can also pass a string as an argument, and will return string without modification.

Kanrisuru::Util.array_join_string(["hello", "world"])
"hello,world"

Kanrisuru::Util.array_join_string(["hello", "world"], ":")
"hello:world"

Kanrisuru::Util.array_join_string("options")
"options"

string_join_array

DEPRECATED

numeric?

Returns true if value is an integer, float, or rational

Kanrisuru::Util.numeric?(0)
true

Kanrisuru::Util.numeric?(3.14159)
true

Kanrisuru::Util.numeric?(Rational(3, 2))
true

Kanrisuru::Util.numeric?("1")
true

Kanrisuru::Util.numeric?("a")
false

camelize

Converts underscore seperated strings into camelized, which is a set of uppercase letters between each work segment.

Kanrisuru::Util.camelize("hello_world")
"HelloWorld"

Kanrisuru::Util.camelize("helloworld")
"Helloworld"