Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/dumper/utils.rb
Overview
– Copyright© 2013 Giovanni Capuano <[email protected]>
This file is part of Dumper.
Dumper is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Dumper is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Dumper. If not, see <www.gnu.org/licenses/>. ++
Instance Method Summary collapse
Instance Method Details
#numeric? ⇒ Boolean
21 22 23 |
# File 'lib/dumper/utils.rb', line 21 def numeric? self.to_i.to_s == self || self.to_f.to_s == self end |
#sanitize_filename ⇒ Object
25 26 27 |
# File 'lib/dumper/utils.rb', line 25 def sanitize_filename self.split(/(?<=.)\.(?=[^.])(?!.*\.[^.])/m).map { |s| s.gsub /[^a-z0-9\-]+/i, ?_ }.join(?.) end |