Class: String

Inherits:
Object
  • Object
show all
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

Instance Method Details

#is_negative?Boolean

Returns true iff the string is negatory/negative.

Returns:

  • (Boolean)


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.

Returns:

  • (Boolean)


45
46
47
# File 'lib/goby/extension.rb', line 45

def is_positive?
  return POSITIVE_RESPONSES.include?(self)
end