Class: Array

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

Instance Method Summary collapse

Instance Method Details

#pad(padding) ⇒ Object

Add padding to each element in the array

Arguments:

padding: (String) The padding to apply before and after the element

Example:

>> array = [ "Name" ]
>> array.pad(" ")
=> [ " Name " ]


12
13
14
# File 'lib/postdb/helpers/array.rb', line 12

def pad(padding)
  map { |element| "#{padding}#{element}#{padding}" }
end