Module: StringUtilityBelt::General

Included in:
String
Defined in:
lib/string_utility_belt/general.rb

Defined Under Namespace

Classes: GENERAL

Constant Summary

WORD_PATTERN =
/\w[\w\'\-]*/
ANY_SPACE_PATTERN =
/\s+/
SIMPLE_SPACE =
" "

Instance Method Summary collapse

Instance Method Details

#have_this_words?(words_to_match, options = nil) ⇒ Boolean

Returns:

  • (Boolean)


65
66
67
68
# File 'lib/string_utility_belt/general.rb', line 65

def have_this_words?(words_to_match, options = nil)
  i = GENERAL.new(self)
  i.have_this_words?(words_to_match, options)
end

#not_have_this_words?(words_to_match, options = nil) ⇒ Boolean

Returns:

  • (Boolean)


70
71
72
73
# File 'lib/string_utility_belt/general.rb', line 70

def not_have_this_words?(words_to_match, options = nil)
  i = GENERAL.new(self)
  !i.have_this_words?(words_to_match, options)
end

#simple_spaceObject



57
58
59
# File 'lib/string_utility_belt/general.rb', line 57

def simple_space
  self.gsub(ANY_SPACE_PATTERN, SIMPLE_SPACE)
end

#simple_space!Object



61
62
63
# File 'lib/string_utility_belt/general.rb', line 61

def simple_space!
  self.gsub!(ANY_SPACE_PATTERN, SIMPLE_SPACE)
end

#wordsObject



53
54
55
# File 'lib/string_utility_belt/general.rb', line 53

def words
  self.scan(WORD_PATTERN)
end