Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/stdlib.rb
Instance Method Summary collapse
- #integer? ⇒ Boolean
- #lstrip_by(chars) ⇒ Object
- #rstrip_by(chars) ⇒ Object
- #stlip(c) ⇒ Object
- #strip_by(chars) ⇒ Object
Instance Method Details
#integer? ⇒ Boolean
40 41 42 |
# File 'lib/stdlib.rb', line 40 def integer? self =~ /^\d+$/ end |
#lstrip_by(chars) ⇒ Object
24 25 26 |
# File 'lib/stdlib.rb', line 24 def lstrip_by(chars) gsub(Regexp.new("^[#{chars}]+"), "") end |
#rstrip_by(chars) ⇒ Object
28 29 30 |
# File 'lib/stdlib.rb', line 28 def rstrip_by(chars) gsub(Regexp.new("[#{chars}]+$"), "") end |
#stlip(c) ⇒ Object
36 37 38 |
# File 'lib/stdlib.rb', line 36 def stlip(c) strip_by(c).split(c) end |
#strip_by(chars) ⇒ Object
32 33 34 |
# File 'lib/stdlib.rb', line 32 def strip_by(chars) lstrip_by(chars).rstrip_by(chars) end |