lib/rext/string/helpers.rb in visionmedia-rext-0.1.0 vs lib/rext/string/helpers.rb in visionmedia-rext-0.2.1

- old
+ new

@@ -247,10 +247,12 @@ def frequency_of_word word word_frequency[word] end + class InvalidSwitchError < StandardError; end + ## # Returns the switch equivilant of this string. # # === Examples # @@ -258,11 +260,9 @@ # 'lots_of_foobar'.switchify # => --lots-of-foobar # 't'.switchify # => -t # ''.switchify # => InvalidSwitchError # - class InvalidSwitchError < StandardError; end - def switchify raise InvalidSwitchError, 'switch must have a length > 0' if length.zero? length > 1 ? "--#{dasherize}" : "-#{self}" end