Class: String
Instance Method Summary collapse
- #as(extension) ⇒ Object
- #delete_if_exists ⇒ Object
- #exists? ⇒ Boolean
- #no_spaces ⇒ Object
- #run ⇒ Object
Instance Method Details
#as(extension) ⇒ Object
6 7 8 |
# File 'lib/cards/extensions.rb', line 6 def as(extension) self.gsub(/\.[^\/]+$/, '') + ".#{extension}" end |
#delete_if_exists ⇒ Object
14 15 16 |
# File 'lib/cards/extensions.rb', line 14 def delete_if_exists File.delete(self) if self.exists? end |
#exists? ⇒ Boolean
10 11 12 |
# File 'lib/cards/extensions.rb', line 10 def exists? File.exist?(self) end |
#no_spaces ⇒ Object
2 3 4 |
# File 'lib/cards/extensions.rb', line 2 def no_spaces self.gsub(' ', '\\ ') end |
#run ⇒ Object
18 19 20 21 |
# File 'lib/cards/extensions.rb', line 18 def run puts self `#{self}` end |