Class: Numeric

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

Instance Method Summary collapse

Instance Method Details

#left_pad(args = {}) ⇒ String

Returns:


24
25
26
27
28
# File 'lib/core_extensions.rb', line 24

def left_pad(args = {})
  char = args.fetch(:with, '0')
  length = args.fetch(:length, 2)
  to_s.rjust length, char
end