Class: ParameterSubstitution::Formatters::CompareString
- Inherits:
-
DateTimeFormat
- Object
- Base
- DateTimeFormat
- ParameterSubstitution::Formatters::CompareString
- Defined in:
- lib/parameter_substitution/formatters/compare_string.rb
Constant Summary
Constants inherited from DateTimeFormat
DateTimeFormat::MINIMUM_INTEGER_TIME
Class Method Summary collapse
Instance Method Summary collapse
- #format(value) ⇒ Object
-
#initialize(compare_value, true_value, false_value) ⇒ CompareString
constructor
A new instance of CompareString.
Methods inherited from DateTimeFormat
from_custom_time, from_parse, from_unix_time_ms, from_unix_time_sec, from_yyyymmddhhmmssss, parse_to_time
Methods inherited from Base
encoding, format, key, parse_duration
Constructor Details
#initialize(compare_value, true_value, false_value) ⇒ CompareString
Returns a new instance of CompareString.
12 13 14 15 16 |
# File 'lib/parameter_substitution/formatters/compare_string.rb', line 12 def initialize(compare_value, true_value, false_value) @compare_value = compare_value @true_value = true_value @false_value = false_value end |
Class Method Details
.description ⇒ Object
4 5 6 |
# File 'lib/parameter_substitution/formatters/compare_string.rb', line 4 def self.description "Compares the field to a string and returns results based on the comparison" end |
.has_parameters? ⇒ Boolean
8 9 10 |
# File 'lib/parameter_substitution/formatters/compare_string.rb', line 8 def self.has_parameters? true end |
Instance Method Details
#format(value) ⇒ Object
18 19 20 |
# File 'lib/parameter_substitution/formatters/compare_string.rb', line 18 def format(value) value.to_s.casecmp(@compare_value) == 0 ? @true_value : @false_value end |