Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Defined in:
- lib/peanuts/xml.rb
Instance Method Summary collapse
Instance Method Details
#from_namespace(ns) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/peanuts/xml.rb', line 6 def from_namespace(ns) rx = /^#{Regexp.quote(ns.to_s)}_(.*)$/ inject({}) do |a, p| a[$1.to_sym] = p[1] if p[0].to_s =~ rx a end end |
#from_namespace!(ns) ⇒ Object
14 15 16 17 18 |
# File 'lib/peanuts/xml.rb', line 14 def from_namespace!(ns) h = from_namespace(ns) h.each_key {|k| delete(:"#{ns}_#{k}") } h end |