Module: Nori::CoreExt::Hash
- Defined in:
- lib/nori/core_ext/hash.rb
Instance Method Summary collapse
-
#normalize_param(key, value) ⇒ String
This key value pair as a param.
-
#to_xml_attributes ⇒ String
The hash as attributes for an XML tag.
Instance Method Details
#normalize_param(key, value) ⇒ String
Returns This key value pair as a param.
13 14 15 16 17 18 19 20 21 |
# File 'lib/nori/core_ext/hash.rb', line 13 def normalize_param(key, value) if value.is_a?(Array) normalize_array_params(key, value) elsif value.is_a?(Hash) normalize_hash_params(key, value) else normalize_simple_type_params(key, value) end end |
#to_xml_attributes ⇒ String
Returns The hash as attributes for an XML tag.
28 29 30 31 32 |
# File 'lib/nori/core_ext/hash.rb', line 28 def to_xml_attributes map do |k, v| %{#{StringUtils.snakecase(k.to_s).sub(/^(.{1,1})/) { |m| m.downcase }}="#{v}"} end.join(' ') end |