Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/helpers/string.rb

Instance Method Summary collapse

Instance Method Details

#increment_versionObject



2
3
4
5
6
7
# File 'lib/helpers/string.rb', line 2

def increment_version
  short_version_parts = self.split('.')
  last_digit = short_version_parts.last.to_i + 1
  $stdout.puts 'Incrementing version...'
  "#{short_version_parts.first(short_version_parts.length-1).join(".")}.#{last_digit}"
end

#increment_version!Object



8
9
10
# File 'lib/helpers/string.rb', line 8

def increment_version!
  replace increment_version
end

#is_number?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/helpers/string.rb', line 11

def is_number?
  true if Float(self) rescue false
end