Class: String
- Defined in:
- lib/sane/present.rb,
lib/sane/string.rb,
lib/sane/contain.rb,
lib/sane/string_blank.rb
Overview
LODO move to sane :) also remove the andand dep.
Instance Method Summary collapse
Instance Method Details
#last(n) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/sane/string.rb', line 8 def last n if n > 0 out = self[-n..-1] else out = '' # case 0 or less end out ||= self.dup # I guess .dup is good... end |
#present? ⇒ Boolean
3 4 5 |
# File 'lib/sane/present.rb', line 3 def present? length > 0 end |
#replace_all!(this_string) ⇒ Object
4 5 6 |
# File 'lib/sane/string.rb', line 4 def replace_all! this_string gsub!(/^.*$/, this_string) end |