Sha256: 93b53bdf6e9d42b4f32ef640c4e0b8e054ef8d5697fbd3f45f0e830f895feeb2
Contents?: true
Size: 1.53 KB
Versions: 2
Compression:
Stored size: 1.53 KB
Contents
module CLIUtils # PrefBehavior Module # Behaviors that should be applied to a Pref's # final value module PrefBehavior # Capitalizes the first word of the passed text. # @param [String] args[0] The text to evaluate # @return [String] def self.capitalize(*args) args[0].capitalize end # Expands the passed text (assumes it # is a filepath). # @param [String] args[0] The text to evaluate # @return [String] def self.local_filepath(*args) File.expand_path(args[0]) end # Lowercases all characters in the passed text. # @param [String] args[0] The text to evaluate # @return [String] def self.lowercase(*args) args[0].downcase end # Adds a prefix to the passed text. # @param [String] args[0] The text to evaluate # @param [String] args[1] The prefix to add # @return [String] def self.prefix(*args) args[1] + args[0] end # Adds a suffix to the passed text. # @param [String] args[0] The text to evaluate # @param [String] args[1] The suffix to add # @return [String] def self.suffix(*args) args[0] + args[1] end # Capitalizes each word in the passed text. # @param [String] args[0] The text to evaluate # @return [String] def self.titlecase(*args) args[0].split.map(&:capitalize).join(' ') end # Uppercases all characters in the passed text. # @param [String] args[0] The text to evaluate # @return [String] def self.uppercase(*args) args[0].upcase end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
cliutils-1.2.8 | lib/cliutils/prefs/pref_behavior.rb |
cliutils-1.2.7 | lib/cliutils/prefs/pref_behavior.rb |