Class: CLIUtils::TitlecaseBehavior

Inherits:
PrefBehavior show all
Defined in:
lib/cliutils/prefs/pref_behaviors/titlecase_behavior.rb

Overview

A Behavior to titlecase a Pref answer

Instance Attribute Summary

Attributes inherited from PrefBehavior

#parameters

Instance Method Summary collapse

Methods included from Messaging

#messenger

Instance Method Details

#evaluate(text) ⇒ String

Evaluates the behavior against the text.

Parameters:

  • text (Object)

    The “text” to evaluate

Returns:



7
8
9
# File 'lib/cliutils/prefs/pref_behaviors/titlecase_behavior.rb', line 7

def evaluate(text)
  text.to_s.split.map(&:capitalize).join(' ')
end