我在這個問題上很掙扎。我已將一個Hashie::Mash
存儲爲一個字符串,並且我很難將其恢復爲散列。Hashie ::從字符串還原Mash
這裏的字符串:
"--- !map:Hashie::Mash \ncreated_at: Mon Jul 30 15:42:20 +0000 2012\nid: 229965155759439872\nid_str: \"229965155759439872\"\ntext: \"#streetart encore plus impressionnant de plus pr\\xC3\\xA8s http://t.co/lUUmXFYs\"\nsource: <a href=\"http://twicca.r246.jp/\" rel=\"nofollow\">twicca</a>\ntruncated: false\nin_reply_to_status_id: \nin_reply_to_status_id_str: \nin_reply_to_user_id: \nin_reply_to_user_id_str: \nin_reply_to_screen_name: \nuser: !map:Hashie::Mash \n id: 15762429\n id_str: \"15762429\"\n name: Cyroul\n screen_name: Cyroultwit\n location: Paris\n description: alias Cyril Rimbaud, explorateur de TAZ, creative Technologist, fondateur du laboratoire Curiouser, enseignant au CELSA et casseur de mythes publicitaires.\n url: http://www.cyroul.com\n protected: false\n followers_count: 7431\n friends_count: 1065\n listed_count: 481\n created_at: Thu Aug 07 12:05:21 +0000 2008\n favourites_count: 10\n utc_offset: 3600\n time_zone: Paris\n geo_enabled: false\n verified: false\n statuses_count: 12726\n lang: fr\n contributors_enabled: false\n is_translator: false\n profile_background_color: 1A1B1F\n profile_background_image_url: http://a0.twimg.com/profile_background_images/6800607/main-cyr.jpg\n profile_background_image_url_https: https://si0.twimg.com/profile_background_images/6800607/main-cyr.jpg\n profile_background_tile: false\n profile_image_url: http://a0.twimg.com/profile_images/2018752881/tete-etoiles-petit-128_normal.jpg\n profile_image_url_https: https://si0.twimg.com/profile_images/2018752881/tete-etoiles-petit-128_normal.jpg\n profile_link_color: 2FC2EF\n profile_sidebar_border_color: 181A1E\n profile_sidebar_fill_color: \"252429\"\n profile_text_color: \"666666\"\n profile_use_background_image: true\n show_all_inline_media: true\n default_profile: false\n default_profile_image: false\n following: false\n follow_request_sent: false\n notifications: false\ngeo: \ncoordinates: \nplace: \ncontributors: \nretweet_count: 0\nentities: !map:Hashie::Mash \n hashtags: \n - !map:Hashie::Mash \n text: streetart\n indices: \n - 0\n - 10\n urls: \n - !map:Hashie::Mash \n url: http://t.co/lUUmXFYs\n expanded_url: http://yfrog.com/nw86guqj\n display_url: yfrog.com/nw86guqj\n indices: \n - 51\n - 71\n user_mentions: []\n\nfavorited: false\nretweeted: false\npossibly_sensitive: false\n"
我怎樣才能哈希回來?提前感謝!
是啊非常感謝! – PEF 2012-07-30 17:10:25
@pef:我很驚訝你*不知不覺地*將數據結構序列化了......這怎麼會發生? – 2012-07-30 17:11:59
我沒有任何想法。我用這個字符串來存儲我正在使用的tweet的原始版本,以防有一天我不得不重用它。我想,它在保存時序列化。 – PEF 2012-07-30 17:14:16