Created
December 22, 2013 23:12
-
-
Save oferreiro/8089547 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "hashie/mash" | |
comments = Hashie::Mash.new | |
data = Hashie::Mash.new | |
from = Hashie::Mash.new | |
from.full_name="marc" | |
from.id="393529" | |
from.profile_picture="http://images.ak.instagram.com/profiles/profile_393529_75sq_1350234816.jpg" | |
from.username="marc" | |
data.created_time="134146266" | |
data.from = from | |
data.id="22813482499" | |
data.text="Opa, parece ate q uso o app para envelhecer o gustavo!kk" | |
comments.count=1 | |
comments.data=[ data ] | |
puts comments.data[0].from.username | |
comments.data.each do |comment| | |
puts comment.from.username | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ irb | |
irb(main):001:0> require "hashie/mash" | |
=> true | |
irb(main):002:0> | |
irb(main):003:0* comments = Hashie::Mash.new | |
=> #<Hashie::Mash> | |
irb(main):004:0> data = Hashie::Mash.new | |
=> #<Hashie::Mash> | |
irb(main):005:0> from = Hashie::Mash.new | |
=> #<Hashie::Mash> | |
irb(main):006:0> | |
irb(main):007:0* from.full_name="marc" | |
=> "marc" | |
irb(main):008:0> from.id="393529" | |
=> "393529" | |
irb(main):009:0> from.profile_picture="http://images.ak.instagram.com/profiles/profile_393529_75sq_1350234816.jpg" | |
=> "http://images.ak.instagram.com/profiles/profile_393529_75sq_1350234816.jpg" | |
irb(main):010:0> from.username="marc" | |
=> "marc" | |
irb(main):011:0> | |
irb(main):012:0* data.created_time="134146266" | |
=> "134146266" | |
irb(main):013:0> data.from = from | |
=> #<Hashie::Mash full_name="marc" id="393529" profile_picture="http://images.ak.instagram.com/profiles/profile_393529_75sq_1350234816.jpg" username="marc"> | |
irb(main):014:0> data.id="22813482499" | |
=> "22813482499" | |
irb(main):015:0> data.text="Opa, parece ate q uso o app para envelhecer o gustavo!kk" | |
=> "Opa, parece ate q uso o app para envelhecer o gustavo!kk" | |
irb(main):016:0> | |
irb(main):017:0* comments.count=1 | |
=> 1 | |
irb(main):018:0> comments.data=[ data ] | |
=> [#<Hashie::Mash created_time="134146266" from=#<Hashie::Mash full_name="marc" id="393529" profile_picture="http://images.ak.instagram.com/profiles/profile_393529_75sq_1350234816.jpg" username="marc"> id="22813482499" text="Opa, parece ate q uso o app para envelhecer o gustavo!kk">] | |
irb(main):019:0> puts comments.data[0].from.username | |
marc | |
=> nil | |
irb(main):020:0> puts comments | |
#<Hashie::Mash count=1 data=[#<Hashie::Mash created_time="134146266" from=#<Hashie::Mash full_name="marc" id="393529" profile_picture="http://images.ak.instagram.com/profiles/profile_393529_75sq_1350234816.jpg" username="marc"> id="22813482499" text="Opa, parece ate q uso o app para envelhecer o gustavo!kk">]> | |
=> nil | |
irb(main):021:0> comments.data.each do |comment| | |
irb(main):022:1* puts comment.from.username | |
irb(main):023:1> end | |
marc | |
=> [#<Hashie::Mash created_time="134146266" from=#<Hashie::Mash full_name="marc" id="393529" profile_picture="http://images.ak.instagram.com/profiles/profile_393529_75sq_1350234816.jpg" username="marc"> id="22813482499" text="Opa, parece ate q uso o app para envelhecer o gustavo!kk">] | |
irb(main):024:0> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment