Class: String

Inherits:
Object show all
Defined in:
lib/cards/extensions.rb

Instance Method Summary collapse

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_existsObject



14
15
16
# File 'lib/cards/extensions.rb', line 14

def delete_if_exists
  File.delete(self) if self.exists?
end

#exists?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/cards/extensions.rb', line 10

def exists?
  File.exist?(self)
end

#no_spacesObject



2
3
4
# File 'lib/cards/extensions.rb', line 2

def no_spaces
  self.gsub(' ', '\\ ')
end

#runObject



18
19
20
21
# File 'lib/cards/extensions.rb', line 18

def run
  puts self
  `#{self}`
end