Class: GoogleSpreadsheets::Enhanced::NamespacePreservable::Format
- Inherits:
-
GDataFormat
- Object
- GDataFormat
- GoogleSpreadsheets::Enhanced::NamespacePreservable::Format
- Defined in:
- lib/google_spreadsheets/enhanced/namespace_preservable.rb
Instance Method Summary collapse
Methods inherited from GDataFormat
Instance Method Details
#decode(xml) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/google_spreadsheets/enhanced/namespace_preservable.rb', line 7 def decode(xml) xml.force_encoding('UTF-8') # cf. http://d.hatena.ne.jp/kitamomonga/20101218/ruby_19_net_http_encoding e = hash_from_xml_with_namespace(xml) if e.has_key?('feed') e = e['feed']['entry'] || [] (e.is_a?(Array) ? e : [e]).each{|i| format_entry(i) } else format_entry(e['entry']) end end |
#encode(hash, options = {}) ⇒ Object
18 19 20 21 |
# File 'lib/google_spreadsheets/enhanced/namespace_preservable.rb', line 18 def encode(hash, = {}) super(hash.select{|key, _| key.match(/^gsx:(.+)/) }, { :namespaces => { 'gsx' => 'http://schemas.google.com/spreadsheets/2006/extended' } }) end |