Sha256: e7a3dd0b08fddbb5c04521a025d0b350bd7950358739df745e1cb37fbd9f635d

Contents?: true

Size: 541 Bytes

Versions: 2

Compression:

Stored size: 541 Bytes

Contents

module Waistband

  module StringifyAll

    module Array

      def stringify_all
        self.map do |val|
          if val.respond_to?(:to_s)
            val.to_s
          else
            val
          end
        end
      end

    end

    module Hash

      def stringify_all
        stringified = {}

        each do |key, val|
          if val.respond_to?(:to_s)
            stringified[key] = val.to_s
          else
            stringified[key] = val
          end
        end

        stringified
      end

    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
waistband-0.1.1 lib/waistband/stringify_all.rb
waistband-0.0.15 lib/waistband/stringify_all.rb