Sha256: 817bf312b07850d09c3f6e505a3f594985ef6afd41094fdae515376c2cff72bc
Contents?: true
Size: 1.7 KB
Versions: 1
Compression:
Stored size: 1.7 KB
Contents
module Pennyworth module Kits # Provides String utilities. class String # Builds a string from an array. # ==== Parameters # * +array+ - Required. The array to build a string from. # * +delimiter+ - Optional. The delimiter used to join each array element. Default: ' ' def self.array_to_string array, delimiter = " " array * delimiter end # Converts and outputs a string array as a downcased string. # ==== Parameters # * +array+ - Required. The string array to process. def self.downcase array string = Pennyworth::Kits::String.array_to_string array puts Pennyworth::Kits::Clipboard.copy(string.downcase) end # Converts and outputs a string array as an upcased string. # ==== Parameters # * +array+ - Required. The string array to process. def self.upcase array string = Pennyworth::Kits::String.array_to_string array puts Pennyworth::Kits::Clipboard.copy(string.upcase) end # Converts and outputs a string array as a capitalized string. # ==== Parameters # * +array+ - Required. The string array to process. def self.capitalize array words = array.map(&:capitalize) words = Pennyworth::Kits::String.array_to_string words puts Pennyworth::Kits::Clipboard.copy(words) end # Converts a string array to a single string and outputs the string length. # ==== Parameters # * +array+ - Required. The string array to process. def self.length array string = Pennyworth::Kits::String.array_to_string array Pennyworth::Kits::Clipboard.copy(string) puts string.length end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pennyworth-3.2.0 | lib/pennyworth/kits/string.rb |