Sha256: 0d1efcd4d8da32ffec2a6ae63d4fc1fede833fe2f54c39d8a4d751d8ed25de7b

Contents?: true

Size: 519 Bytes

Versions: 1

Compression:

Stored size: 519 Bytes

Contents

module Grut
  module Asset
    def self.stringify_hash(hash)
      hash.reduce({}) do |res, (key, val)|
        res[key.to_s] = val.to_s
        res
      end
    end

    def self.sanitize_contract_hash(hash)
      hash.reduce({}) do |res, (key, val)|
        res[:"key_#{key}"] = key
        res[:"val_#{val}"] = val
        res
      end
    end

    def self.contract_sql_condition(hash)
      hash.map do |key, value|
        "key = :key_#{key} and value = :val_#{value}"
      end.join(' and ')
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
grut-0.1.0 lib/grut/asset.rb