Sha256: c6d643b0d02c417c8d5f53c3f17c19b3123866e3fdbeafda751c44d3502189bc

Contents?: true

Size: 527 Bytes

Versions: 2

Compression:

Stored size: 527 Bytes

Contents

require "str_hlpr_dave2/version"

module StrHlprDave2

  def self.reversify(str)
    str.split('').reverse.join('')
  end

  def self.casify(str)
    to_case = [:upcase, :downcase]
    arr = str.split('')
    arr.each_with_index do |letter, i|
      this_case = to_case[rand(2)]
      arr[i] = letter.send(this_case)
    end
    arr.join('')
  end

  def self.spacify(str, spaces = 0)
    new_string = str
    spaces.times do
      new_string = new_string
        .split('')
        .join(' ')
    end
    new_string
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
str_hlpr_dave2-0.2.0 lib/str_hlpr_dave2.rb
str_hlpr_dave2-0.1.0 lib/str_hlpr_dave2.rb