class String

Public Instance Methods

is_i?() click to toggle source

Adds the ability to check if String is an integer (both positive and negative values accepted)

# File lib/toolbox/integer.rb, line 6
def is_i?
  !self.match(/^[-+]?[0-9]+$/).nil?
end
to_bool() click to toggle source

Extending String function to be able to convert a String ‘true’ or ‘false’ to a boolean true/false. See the Boolean module for usage

# File lib/toolbox/boolean.rb, line 7
def to_bool
  (self =~ /^true$/i) == 0
end