Sha256: 7dfc2a956e85f78a49b915f8c4699b0763813a8227ab9b7cdb36ba68c454b2e9

Contents?: true

Size: 535 Bytes

Versions: 22

Compression:

Stored size: 535 Bytes

Contents

module ConfigureS3Website
  class XmlHelper
    def self.hash_to_api_xml(hash={}, indent=0)
      "".tap do |body|
        hash.each do |key, value|
          key_name = key.sub(/^[a-z\d]*/) { $&.capitalize }.gsub(/(?:_|(\/))([a-z\d]*)/) { $2.capitalize }
          value = value.is_a?(Hash) ? self.hash_to_api_xml(value, indent+1) : value
          body << "\n"
          body << " " * indent * 2 # 2-space indentation formatting for xml
          body << "<#{key_name}>#{value}</#{key_name}>"
        end
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 2 rubygems

Version Path
configure-s3-website-ng-3.0.0 lib/configure-s3-website/xml_helper.rb
configure-s3-website-2.3.0 lib/configure-s3-website/xml_helper.rb
configure-s3-website-2.2.0 lib/configure-s3-website/xml_helper.rb
configure-s3-website-2.1.0 lib/configure-s3-website/xml_helper.rb
configure-s3-website-2.0.0 lib/configure-s3-website/xml_helper.rb
configure-s3-website-2.0.0.pre.RC2 lib/configure-s3-website/xml_helper.rb
configure-s3-website-2.0.0.pre.RC1 lib/configure-s3-website/xml_helper.rb
configure-s3-website-1.7.5 lib/configure-s3-website/xml_helper.rb
configure-s3-website-1.7.4 lib/configure-s3-website/xml_helper.rb
configure-s3-website-1.7.3 lib/configure-s3-website/xml_helper.rb
configure-s3-website-1.7.2 lib/configure-s3-website/xml_helper.rb
configure-s3-website-1.7.1 lib/configure-s3-website/xml_helper.rb
configure-s3-website-1.7.0 lib/configure-s3-website/xml_helper.rb
configure-s3-website-1.6.0 lib/configure-s3-website/xml_helper.rb
configure-s3-website-1.5.5 lib/configure-s3-website/xml_helper.rb
configure-s3-website-1.5.4 lib/configure-s3-website/xml_helper.rb
configure-s3-website-1.5.3 lib/configure-s3-website/xml_helper.rb
configure-s3-website-1.5.2 lib/configure-s3-website/xml_helper.rb
configure-s3-website-1.5.1 lib/configure-s3-website/xml_helper.rb
configure-s3-website-1.5.0 lib/configure-s3-website/xml_helper.rb