Sha256: 9c660f0b5186b001c4120a3c9b1b6512169b8cf2ecf439f3b823abbca9f83688

Contents?: true

Size: 520 Bytes

Versions: 2

Compression:

Stored size: 520 Bytes

Contents

class String
  # Strip leading whitespace from each line that is the same as the 
  # amount of whitespace on the first line of the string.
  # Leaves _additional_ indentation on later lines intact.
  def unindent
    gsub /^#{self[/\A\s*/]}/, ''
  end
end

class Object
  def symbolize_keys
    return self.inject({}){|memo,(k,v)| memo[k.to_sym] = v.symbolize_keys; memo} if self.is_a? Hash
    return self.inject([]){|memo,v    | memo           << v.symbolize_keys; memo} if self.is_a? Array
    return self
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
Birst_Command-0.6.1 lib/birst_command/core_additions.rb
Birst_Command-0.6.0 lib/birst_command/core_additions.rb