Class: String

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

Instance Method Summary collapse

Instance Method Details

#firstObject



56
57
58
# File 'lib/benford.rb', line 56

def first
  self.to_i.to_s[0,1]
end

#is_numeric?Boolean

Returns:

  • (Boolean)


60
61
62
# File 'lib/benford.rb', line 60

def is_numeric?
  self.to_s.match(/\A[+-]?\d+?(\.\d+)?\Z/) == nil ? false : true 
end