Module: Paf::CoreExt::String

Defined in:
lib/paf/core_ext/string.rb

Overview

Extend the core String class with PAF specific processing

Instance Method Summary collapse

Instance Method Details

#but_last_wordObject



17
18
19
# File 'lib/paf/core_ext/string.rb', line 17

def but_last_word
  self[0...rindex(' ')]
end

#exception?Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/paf/core_ext/string.rb', line 5

def exception?
  !/^(.|[\d][[:alpha:]]|[\d].*?[\d][[:alpha:]]?)$/.match(self).nil?
end

#last_wordObject



13
14
15
# File 'lib/paf/core_ext/string.rb', line 13

def last_word
  split.last
end

#split_exception?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/paf/core_ext/string.rb', line 9

def split_exception?
  last_word.exception? && /^\d+$/.match(last_word).nil?
end