Sha256: ea88471f5d26edeca14067c9d526d0a777b4e1fc68b6f6f4ad1b0921372a7284

Contents?: true

Size: 419 Bytes

Versions: 5

Compression:

Stored size: 419 Bytes

Contents

module CrossStub
  module Arguments #:nodoc:
    module Hash
      class << self

        def parse(hash)
          hash.inject({}) do |memo, (name, val)|
            marshalized = Base64.encode64(Marshal.dump(val)).gsub('|','\|')
            code = "def #{name} ; Marshal.load(Base64.decode64(%|#{marshalized}|)) ; end"
            memo.merge(:"#{name}" => code)
          end
        end

      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
cross-stub-0.2.4 lib/cross-stub/arguments/hash.rb
cross-stub-0.2.3 lib/cross-stub/arguments/hash.rb
cross-stub-0.2.2 lib/cross-stub/arguments/hash.rb
cross-stub-0.2.1 lib/cross-stub/arguments/hash.rb
cross-stub-0.2.0 lib/cross-stub/arguments/hash.rb