Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added missing to_xml_attributes method to hash

  • Loading branch information...
commit 6f361ed59e11ca29e4967c876567be7cf8e9cca7 1 parent a0f8ade
@jnunemaker authored
Showing with 16 additions and 1 deletion.
  1. +4 −0 History
  2. +11 −0 lib/core_extensions.rb
  3. +1 −1  lib/httparty/version.rb
View
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)
View
11 lib/core_extensions.rb
@@ -333,4 +333,15 @@ def normalize_param(key, value)
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
View
2  lib/httparty/version.rb
@@ -1,3 +1,3 @@
module HTTParty
- Version = '0.2.1'
+ Version = '0.2.2'
end

1 comment on commit 6f361ed

@kennethkalmer

Thanks John, this fixed the issue reported in this gist: http://gist.github.com/33647

Please sign in to comment.
Something went wrong with that request. Please try again.