Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/core_extend/hash.rb

Instance Method Summary collapse

Instance Method Details

#kv_join(s) ⇒ Object

def to_yaml(opts = {})

YAML::quick_emit(object_id, opts) do |out|
  out.map(taguri, to_yaml_style) do |map|
    sort.each do |k, v| # "sort" added
      map.add(k, v)
    end
  end
end

end



12
13
14
15
16
17
18
19
20
21
# File 'lib/core_extend/hash.rb', line 12

def kv_join(s)
  self.map do |k, v|
    if v.is_a?(Hash)
      # When upload a file, make tempfile and other params out of hash.
      v.key?('tempfile') ? "#{k}=#{v['filename']}" : v.kv_join(s)
    else
      "#{k}#{s}#{v}"
    end
  end
end