Skip to content

Instantly share code, notes, and snippets.

@perspectivezoom
Created June 21, 2012 00:22
Show Gist options
  • Save perspectivezoom/2963120 to your computer and use it in GitHub Desktop.
Save perspectivezoom/2963120 to your computer and use it in GitHub Desktop.
class Array
def pad!(min_size, value = nil)
self.concat( Array.new(min_size - self.length, value)) if self.length < min_size
self
end
def pad(min_size, value = nil)
self.dup.pad!(min_size,value)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment