mirror of
https://github.com/jnunemaker/httparty
synced 2023-03-27 23:23:07 -04:00
Added missing to_xml_attributes method to hash
This commit is contained in:
parent
a0f8ade61b
commit
6f361ed59e
3 changed files with 16 additions and 1 deletions
4
History
4
History
|
@ -1,3 +1,7 @@
|
|||
== 0.2.2 2008-12-08
|
||||
* 1 bug fix
|
||||
* Added the missing core extension hash method to_xml_attributes
|
||||
|
||||
== 0.2.1 2008-12-08
|
||||
* 1 bug fix
|
||||
* Fixed that HTTParty was borking ActiveSupport and as such Rails (thanks to Rob Sanheim)
|
||||
|
|
|
@ -333,4 +333,15 @@ class Hash
|
|||
|
||||
param
|
||||
end
|
||||
|
||||
# @return <String> The hash as attributes for an XML tag.
|
||||
#
|
||||
# @example
|
||||
# { :one => 1, "two"=>"TWO" }.to_xml_attributes
|
||||
# #=> 'one="1" two="TWO"'
|
||||
def to_xml_attributes
|
||||
map do |k,v|
|
||||
%{#{k.to_s.snake_case.sub(/^(.{1,1})/) { |m| m.downcase }}="#{v}"}
|
||||
end.join(' ')
|
||||
end
|
||||
end
|
|
@ -1,3 +1,3 @@
|
|||
module HTTParty
|
||||
Version = '0.2.1'
|
||||
Version = '0.2.2'
|
||||
end
|
Loading…
Add table
Reference in a new issue