Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/goby/extension.rb
Overview
Provides additional methods for String.
Constant Summary collapse
- POSITIVE_RESPONSES =
Set of all known positive responses.
Set.new [ "ok", "okay", "sure", "y", "ye", "yeah", "yes" ]
- NEGATIVE_RESPONSES =
Set of all known negative responses.
Set.new [ "n", "nah", "no", "nope" ]
Instance Method Summary collapse
-
#is_negative? ⇒ Boolean
Returns true iff the string is negatory/negative.
-
#is_positive? ⇒ Boolean
Returns true iff the string is affirmative/positive.
Instance Method Details
#is_negative? ⇒ Boolean
Returns true iff the string is negatory/negative.
50 51 52 |
# File 'lib/goby/extension.rb', line 50 def is_negative? return NEGATIVE_RESPONSES.include?(self) end |
#is_positive? ⇒ Boolean
Returns true iff the string is affirmative/positive.
45 46 47 |
# File 'lib/goby/extension.rb', line 45 def is_positive? return POSITIVE_RESPONSES.include?(self) end |