smoke 0.5.17 → 0.5.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. data/README.markdown +5 -5
  2. data/Rakefile +1 -0
  3. data/VERSION.yml +2 -2
  4. data/lib/core_ext/array.rb +12 -0
  5. data/lib/smoke.rb +24 -13
  6. data/lib/smoke/cache.rb +4 -4
  7. data/lib/smoke/origin.rb +6 -11
  8. data/lib/smoke/request.rb +5 -14
  9. data/lib/smoke/transformer.rb +7 -0
  10. data/lib/smoke/transformers/json.rb +15 -0
  11. data/lib/smoke/transformers/ruby.rb +11 -0
  12. data/lib/smoke/{output → transformers}/xml.rb +12 -6
  13. data/lib/smoke/transformers/yaml.rb +15 -0
  14. data/spec/smoke/origin_spec.rb +4 -0
  15. data/spec/smoke/request_spec.rb +7 -0
  16. data/spec/smoke/{output → transformers}/xml_spec.rb +4 -6
  17. data/spec/smoke/transformers_spec.rb +35 -0
  18. data/spec/smoke_spec.rb +18 -10
  19. data/spec/supports/twitter_timeline.json +22 -0
  20. metadata +23 -30
  21. data/rdoc/classes/Smoke.html +0 -260
  22. data/rdoc/classes/Smoke/Origin.html +0 -340
  23. data/rdoc/classes/Smoke/Source/Data.html +0 -126
  24. data/rdoc/classes/Smoke/Source/Feed.html +0 -117
  25. data/rdoc/classes/Smoke/Source/YQL.html +0 -223
  26. data/rdoc/created.rid +0 -1
  27. data/rdoc/files/README_markdown.html +0 -180
  28. data/rdoc/files/lib/core_ext/hash_rb.html +0 -49
  29. data/rdoc/files/lib/smoke/origin_rb.html +0 -49
  30. data/rdoc/files/lib/smoke/request_rb.html +0 -49
  31. data/rdoc/files/lib/smoke/source/data_rb.html +0 -49
  32. data/rdoc/files/lib/smoke/source/feed_rb.html +0 -49
  33. data/rdoc/files/lib/smoke/source/join_rb.html +0 -49
  34. data/rdoc/files/lib/smoke/source/yql_rb.html +0 -49
  35. data/rdoc/files/lib/smoke_rb.html +0 -65
  36. data/rdoc/fr_class_index.html +0 -21
  37. data/rdoc/fr_file_index.html +0 -28
  38. data/rdoc/fr_method_index.html +0 -4459
  39. data/rdoc/index.html +0 -15
  40. data/rdoc/rdoc-style.css +0 -319
  41. data/spec/smoke/input/xls_spec.rb +0 -15
  42. data/spec/smoke/shared_spec.rb +0 -182
  43. data/spec/supports/gov_act_toliets.xls +0 -0
@@ -0,0 +1,22 @@
1
+ HTTP/1.1 200 OK
2
+ Date: Sat, 28 Nov 2009 01:33:50 GMT
3
+ Server: hi
4
+ X-RateLimit-Limit: 150
5
+ X-Transaction: 1259372030-50268-4776
6
+ Status: 200 OK
7
+ ETag: "dab154fd04bc336722629efd9ef194e2"
8
+ Last-Modified: Sat, 28 Nov 2009 01:33:50 GMT
9
+ X-RateLimit-Remaining: 147
10
+ X-Runtime: 0.03547
11
+ Content-Type: application/json; charset=utf-8
12
+ Pragma: no-cache
13
+ Content-Length: 25267
14
+ Cache-Control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0
15
+ Expires: Tue, 31 Mar 1981 05:00:00 GMT
16
+ X-Revision: DEV
17
+ X-RateLimit-Reset: 1259375590
18
+ Set-Cookie: _twitter_sess=BAh7CDoRdHJhbnNfcHJvbXB0MDoHaWQiJTFlYWRlZTBhZjA0NThkNDEwMmU4%250ANzBjN2I1YWJlOTk0IgpmbGFzaElDOidBY3Rpb25Db250cm9sbGVyOjpGbGFz%250AaDo6Rmxhc2hIYXNoewAGOgpAdXNlZHsA--f87ff35e493f3d1e48325a1b470a61533ea92fc3; domain=.twitter.com; path=/
19
+ Vary: Accept-Encoding
20
+ Connection: close
21
+
22
+ [{"in_reply_to_user_id":7840362,"in_reply_to_status_id":6104493462,"truncated":false,"source":"<a href=\"http://www.atebits.com/\" rel=\"nofollow\">Tweetie</a>","favorited":false,"geo":null,"user":{"profile_sidebar_fill_color":"FFFFFF","description":"Interaction designer, Wannabe programmer, American expat living in Sydney, Father of three. Tired.","screen_name":"philoye","followers_count":329,"following":false,"statuses_count":3049,"time_zone":"Sydney","profile_sidebar_border_color":"999999","friends_count":350,"notifications":false,"favourites_count":418,"profile_text_color":"333333","url":"http://philoye.com/","profile_background_image_url":"http://s.twimg.com/a/1259091217/images/themes/theme1/bg.png","geo_enabled":false,"profile_link_color":"FF0000","protected":false,"profile_background_tile":false,"created_at":"Tue Nov 06 20:05:03 +0000 2007","location":"Sydney, Australia","name":"Phil Oye","verified":false,"profile_background_color":"666666","profile_image_url":"http://a1.twimg.com/profile_images/35669362/philoye-bw-square48_normal.jpg","id":10008832,"utc_offset":36000},"in_reply_to_screen_name":"snapperwolf","created_at":"Fri Nov 27 21:44:07 +0000 2009","id":6123426298,"text":"@snapperwolf nice! Do you have their gps app as well?"},{"in_reply_to_user_id":19786014,"in_reply_to_status_id":6110678056,"truncated":false,"source":"<a href=\"http://www.atebits.com/\" rel=\"nofollow\">Tweetie</a>","favorited":false,"geo":null,"user":{"notifications":false,"favourites_count":416,"profile_sidebar_fill_color":"FFFFFF","description":"Interaction designer, Wannabe programmer, American expat living in Sydney, Father of three. Tired.","screen_name":"philoye","following":false,"statuses_count":3048,"time_zone":"Sydney","profile_sidebar_border_color":"999999","geo_enabled":false,"profile_text_color":"333333","url":"http://philoye.com/","verified":false,"profile_background_image_url":"http://s.twimg.com/a/1258570280/images/themes/theme1/bg.png","profile_link_color":"FF0000","followers_count":330,"protected":false,"profile_background_tile":false,"created_at":"Tue Nov 06 20:05:03 +0000 2007","location":"Sydney, Australia","name":"Phil Oye","friends_count":350,"profile_background_color":"666666","profile_image_url":"http://a1.twimg.com/profile_images/35669362/philoye-bw-square48_normal.jpg","id":10008832,"utc_offset":36000},"in_reply_to_screen_name":"MonsterQuads","created_at":"Fri Nov 27 12:42:00 +0000 2009","id":6110808497,"text":"@MonsterQuads Sure I can!"},{"in_reply_to_user_id":14336868,"in_reply_to_status_id":6110521499,"truncated":false,"source":"<a href=\"http://www.atebits.com/\" rel=\"nofollow\">Tweetie</a>","favorited":false,"geo":null,"user":{"profile_sidebar_fill_color":"FFFFFF","description":"Interaction designer, Wannabe programmer, American expat living in Sydney, Father of three. Tired.","screen_name":"philoye","friends_count":350,"following":false,"time_zone":"Sydney","profile_sidebar_border_color":"999999","notifications":false,"favourites_count":416,"statuses_count":3047,"profile_text_color":"333333","url":"http://philoye.com/","profile_background_image_url":"http://s.twimg.com/a/1258570280/images/themes/theme1/bg.png","geo_enabled":false,"profile_link_color":"FF0000","protected":false,"profile_background_tile":false,"created_at":"Tue Nov 06 20:05:03 +0000 2007","location":"Sydney, Australia","name":"Phil Oye","verified":false,"profile_background_color":"666666","profile_image_url":"http://a1.twimg.com/profile_images/35669362/philoye-bw-square48_normal.jpg","id":10008832,"utc_offset":36000,"followers_count":330},"in_reply_to_screen_name":"muser74","created_at":"Fri Nov 27 12:41:50 +0000 2009","id":6110805691,"text":"@muser74 Good question. Must follow through on the decision first..."},{"in_reply_to_user_id":null,"in_reply_to_status_id":null,"truncated":false,"source":"<a href=\"http://www.atebits.com/\" rel=\"nofollow\">Tweetie</a>","favorited":false,"geo":null,"user":{"profile_sidebar_fill_color":"FFFFFF","followers_count":330,"description":"Interaction designer, Wannabe programmer, American expat living in Sydney, Father of three. Tired.","screen_name":"philoye","following":null,"time_zone":"Sydney","friends_count":350,"profile_sidebar_border_color":"999999","geo_enabled":false,"notifications":null,"profile_text_color":"333333","url":"http://philoye.com/","verified":false,"statuses_count":3046,"profile_background_image_url":"http://s.twimg.com/a/1258570280/images/themes/theme1/bg.png","profile_link_color":"FF0000","protected":false,"profile_background_tile":false,"created_at":"Tue Nov 06 20:05:03 +0000 2007","location":"Sydney, Australia","name":"Phil Oye","profile_background_color":"666666","profile_image_url":"http://a1.twimg.com/profile_images/35669362/philoye-bw-square48_normal.jpg","id":10008832,"utc_offset":36000,"favourites_count":416},"in_reply_to_screen_name":null,"created_at":"Fri Nov 27 12:13:41 +0000 2009","id":6110295670,"text":"Just made a big decision. This is going to be good."},{"in_reply_to_user_id":11661,"in_reply_to_status_id":6109621341,"truncated":false,"source":"<a href=\"http://www.atebits.com/\" rel=\"nofollow\">Tweetie</a>","favorited":false,"geo":null,"user":{"profile_sidebar_fill_color":"FFFFFF","description":"Interaction designer, Wannabe programmer, American expat living in Sydney, Father of three. Tired.","screen_name":"philoye","friends_count":350,"following":null,"statuses_count":3045,"time_zone":"Sydney","profile_sidebar_border_color":"999999","notifications":null,"favourites_count":416,"geo_enabled":false,"profile_text_color":"333333","url":"http://philoye.com/","profile_background_image_url":"http://s.twimg.com/a/1258570280/images/themes/theme1/bg.png","verified":false,"profile_link_color":"FF0000","protected":false,"profile_background_tile":false,"created_at":"Tue Nov 06 20:05:03 +0000 2007","location":"Sydney, Australia","name":"Phil Oye","profile_background_color":"666666","profile_image_url":"http://a1.twimg.com/profile_images/35669362/philoye-bw-square48_normal.jpg","id":10008832,"utc_offset":36000,"followers_count":330},"in_reply_to_screen_name":"Hicksdesign","created_at":"Fri Nov 27 12:12:34 +0000 2009","id":6110277351,"text":"@Hicksdesign I keep client work forever. Hard drives keep getting bigger, why purge?"},{"in_reply_to_user_id":5446832,"in_reply_to_status_id":6108889292,"truncated":false,"source":"<a href=\"http://www.atebits.com/\" rel=\"nofollow\">Tweetie</a>","favorited":false,"geo":null,"user":{"profile_sidebar_fill_color":"FFFFFF","description":"Interaction designer, Wannabe programmer, American expat living in Sydney, Father of three. Tired.","screen_name":"philoye","notifications":false,"favourites_count":416,"following":true,"time_zone":"Sydney","profile_sidebar_border_color":"999999","statuses_count":3044,"geo_enabled":false,"profile_text_color":"333333","url":"http://philoye.com/","profile_background_image_url":"http://s.twimg.com/a/1258570280/images/themes/theme1/bg.png","verified":false,"profile_link_color":"FF0000","protected":false,"profile_background_tile":false,"created_at":"Tue Nov 06 20:05:03 +0000 2007","followers_count":330,"location":"Sydney, Australia","name":"Phil Oye","profile_background_color":"666666","profile_image_url":"http://a1.twimg.com/profile_images/35669362/philoye-bw-square48_normal.jpg","id":10008832,"utc_offset":36000,"friends_count":350},"in_reply_to_screen_name":"chrislloyd","created_at":"Fri Nov 27 12:11:17 +0000 2009","id":6110255379,"text":"@chrislloyd I'm much more subtle than that... bastard."},{"in_reply_to_user_id":5446832,"in_reply_to_status_id":6103238619,"truncated":false,"source":"<a href=\"http://www.atebits.com/\" rel=\"nofollow\">Tweetie</a>","favorited":false,"geo":null,"user":{"profile_sidebar_fill_color":"FFFFFF","description":"Interaction designer, Wannabe programmer, American expat living in Sydney, Father of three. Tired.","screen_name":"philoye","followers_count":330,"following":null,"statuses_count":3043,"time_zone":"Sydney","profile_sidebar_border_color":"999999","friends_count":350,"notifications":null,"favourites_count":416,"profile_text_color":"333333","url":"http://philoye.com/","profile_background_image_url":"http://s.twimg.com/a/1258570280/images/themes/theme1/bg.png","geo_enabled":false,"profile_link_color":"FF0000","protected":false,"profile_background_tile":false,"created_at":"Tue Nov 06 20:05:03 +0000 2007","location":"Sydney, Australia","name":"Phil Oye","verified":false,"profile_background_color":"666666","profile_image_url":"http://a1.twimg.com/profile_images/35669362/philoye-bw-square48_normal.jpg","id":10008832,"utc_offset":36000},"in_reply_to_screen_name":"chrislloyd","created_at":"Fri Nov 27 10:26:19 +0000 2009","id":6108595344,"text":"@chrislloyd That hurts."},{"in_reply_to_user_id":59282163,"in_reply_to_status_id":6102227194,"truncated":false,"source":"<a href=\"http://www.atebits.com/\" rel=\"nofollow\">Tweetie</a>","favorited":false,"geo":null,"user":{"profile_sidebar_fill_color":"FFFFFF","followers_count":330,"description":"Interaction designer, Wannabe programmer, American expat living in Sydney, Father of three. Tired.","screen_name":"philoye","following":null,"time_zone":"Sydney","friends_count":350,"profile_sidebar_border_color":"999999","geo_enabled":false,"notifications":null,"profile_text_color":"333333","url":"http://philoye.com/","verified":false,"statuses_count":3042,"profile_background_image_url":"http://s.twimg.com/a/1258570280/images/themes/theme1/bg.png","profile_link_color":"FF0000","protected":false,"profile_background_tile":false,"created_at":"Tue Nov 06 20:05:03 +0000 2007","location":"Sydney, Australia","name":"Phil Oye","profile_background_color":"666666","profile_image_url":"http://a1.twimg.com/profile_images/35669362/philoye-bw-square48_normal.jpg","id":10008832,"utc_offset":36000,"favourites_count":416},"in_reply_to_screen_name":"lstoll","created_at":"Fri Nov 27 04:00:32 +0000 2009","id":6102246599,"text":"@lstoll LIES, now, do a ladle of Ciroc."},{"in_reply_to_user_id":59282163,"in_reply_to_status_id":6102121249,"truncated":false,"source":"<a href=\"http://www.atebits.com/\" rel=\"nofollow\">Tweetie</a>","favorited":false,"geo":null,"user":{"profile_sidebar_fill_color":"FFFFFF","description":"Interaction designer, Wannabe programmer, American expat living in Sydney, Father of three. Tired.","screen_name":"philoye","followers_count":330,"following":null,"statuses_count":3041,"time_zone":"Sydney","profile_sidebar_border_color":"999999","friends_count":350,"notifications":null,"favourites_count":416,"profile_text_color":"333333","url":"http://philoye.com/","profile_background_image_url":"http://s.twimg.com/a/1258570280/images/themes/theme1/bg.png","geo_enabled":false,"profile_link_color":"FF0000","protected":false,"profile_background_tile":false,"created_at":"Tue Nov 06 20:05:03 +0000 2007","location":"Sydney, Australia","name":"Phil Oye","verified":false,"profile_background_color":"666666","profile_image_url":"http://a1.twimg.com/profile_images/35669362/philoye-bw-square48_normal.jpg","id":10008832,"utc_offset":36000},"in_reply_to_screen_name":"lstoll","created_at":"Fri Nov 27 03:58:44 +0000 2009","id":6102204206,"text":"@lstoll Missed out on a spot? There was an open spot on the RSVP list... https://jellynyc.pbworks.com/RSVP-for-Jelly-%40-AR"},{"in_reply_to_user_id":59282163,"in_reply_to_status_id":6102099614,"truncated":false,"source":"<a href=\"http://www.atebits.com/\" rel=\"nofollow\">Tweetie</a>","favorited":false,"geo":null,"user":{"profile_sidebar_fill_color":"FFFFFF","description":"Interaction designer, Wannabe programmer, American expat living in Sydney, Father of three. Tired.","screen_name":"philoye","friends_count":350,"following":true,"statuses_count":3040,"time_zone":"Sydney","profile_sidebar_border_color":"999999","notifications":false,"favourites_count":416,"geo_enabled":false,"profile_text_color":"333333","url":"http://philoye.com/","profile_background_image_url":"http://s.twimg.com/a/1258570280/images/themes/theme1/bg.png","verified":false,"profile_link_color":"FF0000","protected":false,"profile_background_tile":false,"created_at":"Tue Nov 06 20:05:03 +0000 2007","location":"Sydney, Australia","name":"Phil Oye","profile_background_color":"666666","profile_image_url":"http://a1.twimg.com/profile_images/35669362/philoye-bw-square48_normal.jpg","id":10008832,"utc_offset":36000,"followers_count":330},"in_reply_to_screen_name":"lstoll","created_at":"Fri Nov 27 03:55:54 +0000 2009","id":6102141908,"text":"@lstoll It *is* a public holiday in the US... I felt it only appropriate."},{"in_reply_to_user_id":59282163,"in_reply_to_status_id":6102056992,"truncated":false,"source":"<a href=\"http://www.atebits.com/\" rel=\"nofollow\">Tweetie</a>","favorited":false,"geo":null,"user":{"profile_sidebar_fill_color":"FFFFFF","followers_count":330,"description":"Interaction designer, Wannabe programmer, American expat living in Sydney, Father of three. Tired.","screen_name":"philoye","following":false,"time_zone":"Sydney","friends_count":350,"profile_sidebar_border_color":"999999","geo_enabled":false,"notifications":false,"profile_text_color":"333333","url":"http://philoye.com/","verified":false,"statuses_count":3039,"profile_background_image_url":"http://s.twimg.com/a/1258570280/images/themes/theme1/bg.png","profile_link_color":"FF0000","protected":false,"profile_background_tile":false,"created_at":"Tue Nov 06 20:05:03 +0000 2007","location":"Sydney, Australia","name":"Phil Oye","profile_background_color":"666666","profile_image_url":"http://a1.twimg.com/profile_images/35669362/philoye-bw-square48_normal.jpg","id":10008832,"utc_offset":36000,"favourites_count":416},"in_reply_to_screen_name":"lstoll","created_at":"Fri Nov 27 03:53:18 +0000 2009","id":6102085428,"text":"@lstoll Way ahead of you..."},{"in_reply_to_user_id":4928781,"in_reply_to_status_id":6079632837,"truncated":false,"source":"<a href=\"http://www.atebits.com/\" rel=\"nofollow\">Tweetie</a>","favorited":false,"geo":null,"user":{"geo_enabled":false,"profile_sidebar_fill_color":"FFFFFF","description":"Interaction designer, Wannabe programmer, American expat living in Sydney, Father of three. Tired.","screen_name":"philoye","following":null,"verified":false,"time_zone":"Sydney","profile_sidebar_border_color":"999999","followers_count":329,"friends_count":351,"profile_text_color":"333333","url":"http://philoye.com/","profile_background_image_url":"http://s.twimg.com/a/1258570280/images/themes/theme1/bg.png","notifications":null,"favourites_count":414,"profile_link_color":"FF0000","protected":false,"profile_background_tile":false,"created_at":"Tue Nov 06 20:05:03 +0000 2007","location":"Sydney, Australia","name":"Phil Oye","statuses_count":3038,"profile_background_color":"666666","profile_image_url":"http://a1.twimg.com/profile_images/35669362/philoye-bw-square48_normal.jpg","id":10008832,"utc_offset":36000},"in_reply_to_screen_name":"twalve","created_at":"Thu Nov 26 12:14:35 +0000 2009","id":6079747937,"text":"@twalve What a shame..."},{"in_reply_to_user_id":null,"in_reply_to_status_id":null,"truncated":false,"source":"<a href=\"http://www.atebits.com/\" rel=\"nofollow\">Tweetie</a>","favorited":false,"geo":null,"user":{"profile_sidebar_fill_color":"FFFFFF","description":"Interaction designer, Wannabe programmer, American expat living in Sydney, Father of three. Tired.","screen_name":"philoye","followers_count":329,"following":true,"statuses_count":3037,"time_zone":"Sydney","profile_sidebar_border_color":"999999","friends_count":351,"notifications":false,"favourites_count":414,"profile_text_color":"333333","url":"http://philoye.com/","profile_background_image_url":"http://s.twimg.com/a/1258570280/images/themes/theme1/bg.png","geo_enabled":false,"profile_link_color":"FF0000","protected":false,"profile_background_tile":false,"created_at":"Tue Nov 06 20:05:03 +0000 2007","location":"Sydney, Australia","name":"Phil Oye","verified":false,"profile_background_color":"666666","profile_image_url":"http://a1.twimg.com/profile_images/35669362/philoye-bw-square48_normal.jpg","id":10008832,"utc_offset":36000},"in_reply_to_screen_name":null,"created_at":"Thu Nov 26 12:11:51 +0000 2009","id":6079702262,"text":"Cockroaches are big and plentiful in this country."},{"in_reply_to_user_id":null,"in_reply_to_status_id":null,"truncated":false,"source":"<a href=\"http://www.atebits.com/\" rel=\"nofollow\">Tweetie</a>","favorited":false,"geo":null,"user":{"profile_sidebar_fill_color":"FFFFFF","description":"Interaction designer, Wannabe programmer, American expat living in Sydney, Father of three. Tired.","screen_name":"philoye","friends_count":351,"following":true,"statuses_count":3036,"time_zone":"Sydney","profile_sidebar_border_color":"999999","notifications":false,"favourites_count":414,"geo_enabled":false,"profile_text_color":"333333","url":"http://philoye.com/","profile_background_image_url":"http://s.twimg.com/a/1258570280/images/themes/theme1/bg.png","verified":false,"profile_link_color":"FF0000","protected":false,"profile_background_tile":false,"created_at":"Tue Nov 06 20:05:03 +0000 2007","location":"Sydney, Australia","name":"Phil Oye","profile_background_color":"666666","profile_image_url":"http://a1.twimg.com/profile_images/35669362/philoye-bw-square48_normal.jpg","id":10008832,"utc_offset":36000,"followers_count":329},"in_reply_to_screen_name":null,"created_at":"Thu Nov 26 11:44:30 +0000 2009","id":6079249122,"text":"Hey @mrspeaker, are you iPhone equipped? This looks like right up your alley: http://mrgan.tumblr.com/post/257187093/pie-guy"},{"in_reply_to_user_id":null,"in_reply_to_status_id":null,"truncated":false,"source":"<a href=\"http://www.atebits.com/\" rel=\"nofollow\">Tweetie</a>","favorited":false,"geo":null,"user":{"profile_sidebar_fill_color":"FFFFFF","description":"Interaction designer, Wannabe programmer, American expat living in Sydney, Father of three. Tired.","screen_name":"philoye","followers_count":329,"following":null,"statuses_count":3035,"time_zone":"Sydney","profile_sidebar_border_color":"999999","friends_count":355,"notifications":null,"favourites_count":413,"profile_text_color":"333333","url":"http://philoye.com/","profile_background_image_url":"http://s.twimg.com/a/1258570280/images/themes/theme1/bg.png","geo_enabled":false,"profile_link_color":"FF0000","protected":false,"profile_background_tile":false,"created_at":"Tue Nov 06 20:05:03 +0000 2007","location":"Sydney, Australia","name":"Phil Oye","verified":false,"profile_background_color":"666666","profile_image_url":"http://a1.twimg.com/profile_images/35669362/philoye-bw-square48_normal.jpg","id":10008832,"utc_offset":36000},"in_reply_to_screen_name":null,"created_at":"Wed Nov 25 22:16:59 +0000 2009","id":6062855190,"text":"I am thankful that @simonoye, @felixoye, and @jessicaoye all slept in to 6:30 this morning."},{"in_reply_to_user_id":735633,"in_reply_to_status_id":6044206457,"truncated":false,"source":"<a href=\"http://www.atebits.com/\" rel=\"nofollow\">Tweetie</a>","favorited":false,"geo":null,"user":{"profile_sidebar_fill_color":"FFFFFF","description":"Interaction designer, Wannabe programmer, American expat living in Sydney, Father of three. Tired.","screen_name":"philoye","friends_count":356,"following":null,"statuses_count":3034,"time_zone":"Sydney","profile_sidebar_border_color":"999999","notifications":null,"favourites_count":413,"geo_enabled":false,"profile_text_color":"333333","url":"http://philoye.com/","profile_background_image_url":"http://s.twimg.com/a/1258570280/images/themes/theme1/bg.png","verified":false,"profile_link_color":"FF0000","protected":false,"profile_background_tile":false,"created_at":"Tue Nov 06 20:05:03 +0000 2007","location":"Sydney, Australia","name":"Phil Oye","profile_background_color":"666666","profile_image_url":"http://a1.twimg.com/profile_images/35669362/philoye-bw-square48_normal.jpg","id":10008832,"utc_offset":36000,"followers_count":330},"in_reply_to_screen_name":"mrspeaker","created_at":"Wed Nov 25 08:22:19 +0000 2009","id":6044618481,"text":". @mrspeaker that is a hot design. Who knew that google could be supplanted so easily?"},{"in_reply_to_user_id":null,"in_reply_to_status_id":null,"truncated":false,"source":"<a href=\"http://www.atebits.com/\" rel=\"nofollow\">Tweetie</a>","favorited":false,"geo":null,"user":{"profile_sidebar_fill_color":"FFFFFF","description":"Interaction designer, Wannabe programmer, American expat living in Sydney, Father of three. Tired.","screen_name":"philoye","notifications":false,"favourites_count":413,"following":false,"time_zone":"Sydney","profile_sidebar_border_color":"999999","statuses_count":3033,"geo_enabled":false,"profile_text_color":"333333","url":"http://philoye.com/","profile_background_image_url":"http://s.twimg.com/a/1258570280/images/themes/theme1/bg.png","verified":false,"profile_link_color":"FF0000","protected":false,"profile_background_tile":false,"created_at":"Tue Nov 06 20:05:03 +0000 2007","followers_count":330,"location":"Sydney, Australia","name":"Phil Oye","profile_background_color":"666666","profile_image_url":"http://a1.twimg.com/profile_images/35669362/philoye-bw-square48_normal.jpg","id":10008832,"utc_offset":36000,"friends_count":356},"in_reply_to_screen_name":null,"created_at":"Wed Nov 25 00:47:43 +0000 2009","id":6035090091,"text":"Sending stuff to press is always a scary proposition."},{"in_reply_to_user_id":15267581,"in_reply_to_status_id":6022757970,"truncated":false,"source":"<a href=\"http://www.atebits.com/\" rel=\"nofollow\">Tweetie</a>","favorited":false,"geo":null,"user":{"profile_sidebar_fill_color":"FFFFFF","description":"Interaction designer, Wannabe programmer, American expat living in Sydney, Father of three. Tired.","screen_name":"philoye","friends_count":356,"following":null,"time_zone":"Sydney","profile_sidebar_border_color":"999999","notifications":null,"favourites_count":413,"statuses_count":3032,"profile_text_color":"333333","url":"http://philoye.com/","profile_background_image_url":"http://s.twimg.com/a/1258570280/images/themes/theme1/bg.png","geo_enabled":false,"profile_link_color":"FF0000","protected":false,"profile_background_tile":false,"created_at":"Tue Nov 06 20:05:03 +0000 2007","location":"Sydney, Australia","name":"Phil Oye","verified":false,"profile_background_color":"666666","profile_image_url":"http://a1.twimg.com/profile_images/35669362/philoye-bw-square48_normal.jpg","id":10008832,"utc_offset":36000,"followers_count":330},"in_reply_to_screen_name":"jontobey","created_at":"Wed Nov 25 00:19:25 +0000 2009","id":6024366331,"text":"@jontobey So they can send you a nice official offer in the mail for the job you are most certainly going to get."},{"in_reply_to_screen_name":null,"in_reply_to_user_id":null,"in_reply_to_status_id":null,"source":"<a href=\"http://www.atebits.com/\" rel=\"nofollow\">Tweetie</a>","truncated":false,"user":{"profile_background_tile":false,"followers_count":330,"description":"Interaction designer, Wannabe programmer, American expat living in Sydney, Father of three. Tired.","profile_background_color":"666666","profile_image_url":"http://a1.twimg.com/profile_images/35669362/philoye-bw-square48_normal.jpg","following":null,"friends_count":356,"profile_sidebar_fill_color":"FFFFFF","screen_name":"philoye","notifications":null,"favourites_count":413,"time_zone":"Sydney","profile_sidebar_border_color":"999999","url":"http://philoye.com/","statuses_count":3031,"protected":false,"geo_enabled":false,"created_at":"Tue Nov 06 20:05:03 +0000 2007","profile_text_color":"333333","location":"Sydney, Australia","name":"Phil Oye","profile_background_image_url":"http://s.twimg.com/a/1258570280/images/themes/theme1/bg.png","id":10008832,"verified":false,"utc_offset":36000,"profile_link_color":"FF0000"},"created_at":"Tue Nov 24 22:55:33 +0000 2009","favorited":false,"id":6022089657,"geo":null,"text":"Hey @johndevanney, this one is for you: http://www.youtube.com/watch?v=tgbNymZ7vqY"},{"in_reply_to_screen_name":"jontobey","in_reply_to_user_id":15267581,"in_reply_to_status_id":6021422405,"source":"<a href=\"http://www.atebits.com/\" rel=\"nofollow\">Tweetie</a>","truncated":false,"user":{"profile_background_tile":false,"description":"Interaction designer, Wannabe programmer, American expat living in Sydney, Father of three. Tired.","profile_background_color":"666666","profile_image_url":"http://a1.twimg.com/profile_images/35669362/philoye-bw-square48_normal.jpg","following":false,"followers_count":330,"profile_sidebar_fill_color":"FFFFFF","screen_name":"philoye","friends_count":356,"statuses_count":3031,"time_zone":"Sydney","profile_sidebar_border_color":"999999","url":"http://philoye.com/","notifications":false,"favourites_count":413,"protected":false,"geo_enabled":false,"created_at":"Tue Nov 06 20:05:03 +0000 2007","profile_text_color":"333333","location":"Sydney, Australia","name":"Phil Oye","profile_background_image_url":"http://s.twimg.com/a/1258570280/images/themes/theme1/bg.png","id":10008832,"verified":false,"utc_offset":36000,"profile_link_color":"FF0000"},"created_at":"Tue Nov 24 22:52:43 +0000 2009","favorited":false,"id":6022013916,"geo":null,"text":"@jontobey Uh, perhaps to see if the person is local to the company and (easily) hireable?"}]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smoke
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.17
4
+ version: 0.5.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Schwarz
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-10-29 00:00:00 +11:00
12
+ date: 2010-01-24 00:00:00 +11:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -82,6 +82,16 @@ dependencies:
82
82
  - !ruby/object:Gem::Version
83
83
  version: 1.3.2
84
84
  version:
85
+ - !ruby/object:Gem::Dependency
86
+ name: registry
87
+ type: :runtime
88
+ version_requirement:
89
+ version_requirements: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: 0.1.2
94
+ version:
85
95
  description:
86
96
  email: ben.schwarz@gmail.com
87
97
  executables: []
@@ -96,60 +106,44 @@ files:
96
106
  - README.markdown
97
107
  - Rakefile
98
108
  - VERSION.yml
109
+ - lib/core_ext/array.rb
99
110
  - lib/core_ext/hash.rb
100
111
  - lib/core_ext/string.rb
101
112
  - lib/smoke.rb
102
113
  - lib/smoke/cache.rb
103
114
  - lib/smoke/origin.rb
104
- - lib/smoke/output/xml.rb
105
115
  - lib/smoke/request.rb
106
116
  - lib/smoke/source/data.rb
107
117
  - lib/smoke/source/feed.rb
108
118
  - lib/smoke/source/join.rb
109
119
  - lib/smoke/source/yql.rb
110
- - rdoc/classes/Smoke.html
111
- - rdoc/classes/Smoke/Origin.html
112
- - rdoc/classes/Smoke/Source/Data.html
113
- - rdoc/classes/Smoke/Source/Feed.html
114
- - rdoc/classes/Smoke/Source/YQL.html
115
- - rdoc/created.rid
116
- - rdoc/files/README_markdown.html
117
- - rdoc/files/lib/core_ext/hash_rb.html
118
- - rdoc/files/lib/smoke/origin_rb.html
119
- - rdoc/files/lib/smoke/request_rb.html
120
- - rdoc/files/lib/smoke/source/data_rb.html
121
- - rdoc/files/lib/smoke/source/feed_rb.html
122
- - rdoc/files/lib/smoke/source/join_rb.html
123
- - rdoc/files/lib/smoke/source/yql_rb.html
124
- - rdoc/files/lib/smoke_rb.html
125
- - rdoc/fr_class_index.html
126
- - rdoc/fr_file_index.html
127
- - rdoc/fr_method_index.html
128
- - rdoc/index.html
129
- - rdoc/rdoc-style.css
120
+ - lib/smoke/transformer.rb
121
+ - lib/smoke/transformers/json.rb
122
+ - lib/smoke/transformers/ruby.rb
123
+ - lib/smoke/transformers/xml.rb
124
+ - lib/smoke/transformers/yaml.rb
130
125
  - spec/core_ext/hash_spec.rb
131
126
  - spec/smoke/cache_spec.rb
132
- - spec/smoke/input/xls_spec.rb
133
127
  - spec/smoke/origin_spec.rb
134
- - spec/smoke/output/xml_spec.rb
135
128
  - spec/smoke/request_spec.rb
136
- - spec/smoke/shared_spec.rb
137
129
  - spec/smoke/source/data_spec.rb
138
130
  - spec/smoke/source/feed_spec.rb
139
131
  - spec/smoke/source/join_spec.rb
140
132
  - spec/smoke/source/yql_spec.rb
133
+ - spec/smoke/transformers/xml_spec.rb
134
+ - spec/smoke/transformers_spec.rb
141
135
  - spec/smoke_spec.rb
142
136
  - spec/spec.opts
143
137
  - spec/spec_helper.rb
144
138
  - spec/supports/amc_pacer.json.yql
145
139
  - spec/supports/datatables.yql
146
140
  - spec/supports/flickr-photo.json
147
- - spec/supports/gov_act_toliets.xls
148
141
  - spec/supports/gzip_response.txt
149
142
  - spec/supports/search-web.json.yql
150
143
  - spec/supports/search-web.xml.yql
151
144
  - spec/supports/slashdot.xml
152
145
  - spec/supports/test_source.rb
146
+ - spec/supports/twitter_timeline.json
153
147
  has_rdoc: true
154
148
  homepage: http://github.com/benschwarz/smoke
155
149
  licenses: []
@@ -181,15 +175,14 @@ summary: smoke is a Ruby based DSL that allows you to query web services such as
181
175
  test_files:
182
176
  - spec/core_ext/hash_spec.rb
183
177
  - spec/smoke/cache_spec.rb
184
- - spec/smoke/input/xls_spec.rb
185
178
  - spec/smoke/origin_spec.rb
186
- - spec/smoke/output/xml_spec.rb
187
179
  - spec/smoke/request_spec.rb
188
- - spec/smoke/shared_spec.rb
189
180
  - spec/smoke/source/data_spec.rb
190
181
  - spec/smoke/source/feed_spec.rb
191
182
  - spec/smoke/source/join_spec.rb
192
183
  - spec/smoke/source/yql_spec.rb
184
+ - spec/smoke/transformers/xml_spec.rb
185
+ - spec/smoke/transformers_spec.rb
193
186
  - spec/smoke_spec.rb
194
187
  - spec/spec_helper.rb
195
188
  - spec/supports/test_source.rb
@@ -1,260 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2
- <html lang='en'>
3
- <head>
4
- <title>: Smoke [smoke]</title>
5
- <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'>
6
- <link href='../rdoc-style.css' media='screen' rel='stylesheet' type='text/css'>
7
- <script type='text/javascript'>
8
- //<![CDATA[
9
- function popupCode(url) {
10
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
11
- }
12
-
13
- function toggleCode(id) {
14
- var code = document.getElementById(id)
15
-
16
- code.style.display = code.style.display != 'block' ? 'block' : 'none'
17
- return true
18
- }
19
-
20
- // Make codeblocks hidden by default
21
- document.writeln('<' + 'style type="text/css">.method .source pre { display: none }<\/style>')
22
- //]]>
23
- </script>
24
- </head>
25
- <body class='page'>
26
- <div class='class' id='wrapper'>
27
- <div class='header'>
28
- <h1 class='name'>
29
- <span class='type'>Module</span>
30
- Smoke
31
- </h1>
32
- <ol class='paths'>
33
- <li>
34
- <a href="../files/lib/smoke/request_rb.html">lib/smoke/request.rb</a>
35
- </li>
36
- <li class='other'>
37
- <a href="../files/lib/smoke/origin_rb.html">lib/smoke/origin.rb</a>
38
- </li>
39
- <li class='other'>
40
- <a href="../files/lib/smoke/source/data_rb.html">lib/smoke/source/data.rb</a>
41
- </li>
42
- <li class='other'>
43
- <a href="../files/lib/smoke/source/feed_rb.html">lib/smoke/source/feed.rb</a>
44
- </li>
45
- <li class='other'>
46
- <a href="../files/lib/smoke/source/join_rb.html">lib/smoke/source/join.rb</a>
47
- </li>
48
- <li class='other'>
49
- <a href="../files/lib/smoke/source/yql_rb.html">lib/smoke/source/yql.rb</a>
50
- </li>
51
- <li class='other'>
52
- <a href="../files/lib/smoke_rb.html">lib/smoke.rb</a>
53
- </li>
54
- <li>
55
- <a class='show' href='#' onclick='this.parentNode.parentNode.className += " expanded"; this.parentNode.removeChild(this); return false'>show all</a>
56
- </li>
57
- </ol>
58
- </div>
59
- <div id='content'>
60
- <div id='text'>
61
- <div id='method-list'>
62
- <h2>Methods</h2>
63
- <h3>public class</h3>
64
- <ol>
65
- <li><a href="#M000001">[]</a></li>
66
- <li><a href="#M000002">activate</a></li>
67
- <li><a href="#M000003">active_sources</a></li>
68
- <li><a href="#M000007">data</a></li>
69
- <li><a href="#M000008">feed</a></li>
70
- <li><a href="#M000009">join</a></li>
71
- <li><a href="#M000005">log</a></li>
72
- <li><a href="#M000004">rename</a></li>
73
- <li><a href="#M000006">yql</a></li>
74
- </ol>
75
- </div>
76
- <div id='section'>
77
- <div id='class-list'>
78
- <h2>Classes and Modules</h2>
79
- Class <a href="Smoke/Origin.html" class="link">Smoke::Origin</a><br />
80
- </div>
81
- <div id='attribute-list'>
82
- <h2 class='section-bar'>Attributes</h2>
83
- <div class='name-list'>
84
- <table>
85
- <tr class='top-aligned-row context-row'>
86
- <td class='context-item-name'>active_sources</td>
87
- <td class='context-item-value'>[R]</td>
88
- <td class='context-item-desc'></td>
89
- </tr>
90
- </table>
91
- </div>
92
- </div>
93
- <div id='methods'>
94
- <h2>Public class methods</h2>
95
- <div class='public-class method' id='method-M000001'>
96
- <a name='M000001'> </a>
97
- <div class='synopsis'>
98
- <span class='name'>[]</span>
99
- <span class='arguments'>(source)</span>
100
- </div>
101
- <div class='description'>
102
- <p>
103
- Access registered smoke source instances
104
- </p>
105
- <p>
106
- Usage:
107
- </p>
108
- <pre>Smoke.yql(:ruby) do ....&#x000A;&#x000A;Smoke[:ruby]&#x000A;=&gt; #&lt;Smoke::Source::YQL::0x18428d4...</pre>
109
- </div>
110
- <div class='source'>
111
- <a class='source-toggle' href='#' onclick="toggleCode('M000001-source'); return false">
112
- [show source]
113
- </a>
114
- <pre id='M000001-source'> <span class="ruby-comment cmt"># File lib/smoke.rb, line 26</span>&#x000A;26: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">[]</span>(<span class="ruby-identifier">source</span>)&#x000A;27: <span class="ruby-identifier">active_sources</span>[<span class="ruby-identifier">source</span>]&#x000A;28: <span class="ruby-keyword kw">end</span></pre>
115
- </div>
116
- </div>
117
- <div class='public-class method' id='method-M000002'>
118
- <a name='M000002'> </a>
119
- <div class='synopsis'>
120
- <span class='name'>activate</span>
121
- <span class='arguments'>(name, source)</span>
122
- </div>
123
- <div class='description'>
124
- <p>
125
- Activates new instances of sources Source instances are stored within the
126
- @@<a href="Smoke.html#M000003">active_sources</a> class variable for later
127
- use
128
- </p>
129
- </div>
130
- <div class='source'>
131
- <a class='source-toggle' href='#' onclick="toggleCode('M000002-source'); return false">
132
- [show source]
133
- </a>
134
- <pre id='M000002-source'> <span class="ruby-comment cmt"># File lib/smoke.rb, line 33</span>&#x000A;33: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">activate</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">source</span>)&#x000A;34: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">active_sources</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">name</span>)&#x000A;35: <span class="ruby-constant">Smoke</span>.<span class="ruby-identifier">log</span>.<span class="ruby-identifier">warn</span> <span class="ruby-value str">&quot;Smoke source activation: Source with idential name already initialized&quot;</span> &#x000A;36: <span class="ruby-keyword kw">end</span>&#x000A;37: <span class="ruby-identifier">active_sources</span>.<span class="ruby-identifier">update</span>({ <span class="ruby-identifier">name</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">source</span> })&#x000A;38: <span class="ruby-keyword kw">end</span></pre>
135
- </div>
136
- </div>
137
- <div class='public-class method' id='method-M000003'>
138
- <a name='M000003'> </a>
139
- <div class='synopsis'>
140
- <span class='name'>active_sources</span>
141
- <span class='arguments'>()</span>
142
- </div>
143
- <div class='description'>
144
- <p>
145
- Returns all activated smoke sources
146
- </p>
147
- </div>
148
- <div class='source'>
149
- <a class='source-toggle' href='#' onclick="toggleCode('M000003-source'); return false">
150
- [show source]
151
- </a>
152
- <pre id='M000003-source'> <span class="ruby-comment cmt"># File lib/smoke.rb, line 41</span>&#x000A;41: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">active_sources</span>&#x000A;42: <span class="ruby-ivar">@@active_sources</span>&#x000A;43: <span class="ruby-keyword kw">end</span></pre>
153
- </div>
154
- </div>
155
- <div class='public-class method' id='method-M000007'>
156
- <a name='M000007'> </a>
157
- <div class='synopsis'>
158
- <span class='name'>data</span>
159
- <span class='arguments'>(name, &amp;block)</span>
160
- </div>
161
- <div class='source'>
162
- <a class='source-toggle' href='#' onclick="toggleCode('M000007-source'); return false">
163
- [show source]
164
- </a>
165
- <pre id='M000007-source'> <span class="ruby-comment cmt"># File lib/smoke.rb, line 65</span>&#x000A;65: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">data</span>(<span class="ruby-identifier">name</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>); <span class="ruby-constant">Smoke</span><span class="ruby-operator">::</span><span class="ruby-constant">Source</span><span class="ruby-operator">::</span><span class="ruby-constant">Data</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">name</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>); <span class="ruby-keyword kw">end</span></pre>
166
- </div>
167
- </div>
168
- <div class='public-class method' id='method-M000008'>
169
- <a name='M000008'> </a>
170
- <div class='synopsis'>
171
- <span class='name'>feed</span>
172
- <span class='arguments'>(name, &amp;block)</span>
173
- </div>
174
- <div class='source'>
175
- <a class='source-toggle' href='#' onclick="toggleCode('M000008-source'); return false">
176
- [show source]
177
- </a>
178
- <pre id='M000008-source'> <span class="ruby-comment cmt"># File lib/smoke.rb, line 66</span>&#x000A;66: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">feed</span>(<span class="ruby-identifier">name</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>); <span class="ruby-constant">Smoke</span><span class="ruby-operator">::</span><span class="ruby-constant">Source</span><span class="ruby-operator">::</span><span class="ruby-constant">Feed</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">name</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>); <span class="ruby-keyword kw">end</span></pre>
179
- </div>
180
- </div>
181
- <div class='public-class method' id='method-M000009'>
182
- <a name='M000009'> </a>
183
- <div class='synopsis'>
184
- <span class='name'>join</span>
185
- <span class='arguments'>(*names, &amp;block)</span>
186
- </div>
187
- <div class='description'>
188
- <p>
189
- Join multiple sources together into a single feed Usage:
190
- </p>
191
- <pre>Smoke.join(:delicious, :twitter, :flickr) do&#x000A; name :stream&#x000A; path :photos, :photo&#x000A;end</pre>
192
- </div>
193
- <div class='source'>
194
- <a class='source-toggle' href='#' onclick="toggleCode('M000009-source'); return false">
195
- [show source]
196
- </a>
197
- <pre id='M000009-source'> <span class="ruby-comment cmt"># File lib/smoke.rb, line 74</span>&#x000A;74: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">join</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">names</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>); <span class="ruby-constant">Smoke</span><span class="ruby-operator">::</span><span class="ruby-constant">Source</span><span class="ruby-operator">::</span><span class="ruby-constant">Join</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">names</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>); <span class="ruby-keyword kw">end</span></pre>
198
- </div>
199
- </div>
200
- <div class='public-class method' id='method-M000005'>
201
- <a name='M000005'> </a>
202
- <div class='synopsis'>
203
- <span class='name'>log</span>
204
- <span class='arguments'>()</span>
205
- </div>
206
- <div class='description'>
207
- <p>
208
- Log for info, debug, error and warn with:
209
- </p>
210
- <pre>Smoke.log.info &quot;message&quot;&#x000A;Smoke.log.debug &quot;message&quot;&#x000A;Smoke.log.error &quot;message&quot;&#x000A;Smoke.log.warn &quot;message&quot;</pre>
211
- </div>
212
- <div class='source'>
213
- <a class='source-toggle' href='#' onclick="toggleCode('M000005-source'); return false">
214
- [show source]
215
- </a>
216
- <pre id='M000005-source'> <span class="ruby-comment cmt"># File lib/smoke.rb, line 60</span>&#x000A;60: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">log</span>&#x000A;61: <span class="ruby-ivar">@@log</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">Logger</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">$stdout</span>)&#x000A;62: <span class="ruby-keyword kw">end</span></pre>
217
- </div>
218
- </div>
219
- <div class='public-class method' id='method-M000004'>
220
- <a name='M000004'> </a>
221
- <div class='synopsis'>
222
- <span class='name'>rename</span>
223
- <span class='arguments'>(candidates)</span>
224
- </div>
225
- <div class='description'>
226
- <p>
227
- Rename a source
228
- </p>
229
- </div>
230
- <div class='source'>
231
- <a class='source-toggle' href='#' onclick="toggleCode('M000004-source'); return false">
232
- [show source]
233
- </a>
234
- <pre id='M000004-source'> <span class="ruby-comment cmt"># File lib/smoke.rb, line 46</span>&#x000A;46: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">rename</span>(<span class="ruby-identifier">candidates</span>)&#x000A;47: <span class="ruby-identifier">candidates</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">o</span>, <span class="ruby-identifier">n</span><span class="ruby-operator">|</span> &#x000A;48: <span class="ruby-identifier">active_sources</span>[<span class="ruby-identifier">o</span>].<span class="ruby-identifier">name</span> = <span class="ruby-identifier">n</span>.<span class="ruby-identifier">to_s</span>&#x000A;49: <span class="ruby-identifier">active_sources</span>.<span class="ruby-identifier">rename</span>(<span class="ruby-identifier">o</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">n</span>)&#x000A;50: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">active_sources</span>[<span class="ruby-identifier">n</span>]&#x000A;51: <span class="ruby-keyword kw">end</span>&#x000A;52: <span class="ruby-keyword kw">end</span></pre>
235
- </div>
236
- </div>
237
- <div class='public-class method' id='method-M000006'>
238
- <a name='M000006'> </a>
239
- <div class='synopsis'>
240
- <span class='name'>yql</span>
241
- <span class='arguments'>(name, &amp;block)</span>
242
- </div>
243
- <div class='source'>
244
- <a class='source-toggle' href='#' onclick="toggleCode('M000006-source'); return false">
245
- [show source]
246
- </a>
247
- <pre id='M000006-source'> <span class="ruby-comment cmt"># File lib/smoke.rb, line 64</span>&#x000A;64: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">yql</span>(<span class="ruby-identifier">name</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>); <span class="ruby-constant">Smoke</span><span class="ruby-operator">::</span><span class="ruby-constant">Source</span><span class="ruby-operator">::</span><span class="ruby-constant">YQL</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">name</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>); <span class="ruby-keyword kw">end</span></pre>
248
- </div>
249
- </div>
250
- </div>
251
- </div>
252
- </div>
253
- </div>
254
- <div id='footer-push'></div>
255
- </div>
256
- <div id='footer'>
257
- <a href="http://github.com/mislav/hanna/tree/master"><strong>Hanna</strong> RDoc template</a>
258
- </div>
259
- </body>
260
- </html>
@@ -1,340 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2
- <html lang='en'>
3
- <head>
4
- <title>: Smoke::Origin [smoke]</title>
5
- <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'>
6
- <link href='../../rdoc-style.css' media='screen' rel='stylesheet' type='text/css'>
7
- <script type='text/javascript'>
8
- //<![CDATA[
9
- function popupCode(url) {
10
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
11
- }
12
-
13
- function toggleCode(id) {
14
- var code = document.getElementById(id)
15
-
16
- code.style.display = code.style.display != 'block' ? 'block' : 'none'
17
- return true
18
- }
19
-
20
- // Make codeblocks hidden by default
21
- document.writeln('<' + 'style type="text/css">.method .source pre { display: none }<\/style>')
22
- //]]>
23
- </script>
24
- </head>
25
- <body class='page'>
26
- <div class='class' id='wrapper'>
27
- <div class='header'>
28
- <h1 class='name'>
29
- <span class='type'>Class</span>
30
- Smoke::Origin
31
- </h1>
32
- <ol class='paths'>
33
- <li>
34
- <a href="../../files/lib/smoke/origin_rb.html">lib/smoke/origin.rb</a>
35
- </li>
36
- </ol>
37
- <div class='parent'>
38
- Parent:
39
- <strong>Object</strong>
40
- </div>
41
- </div>
42
- <div id='content'>
43
- <div id='text'>
44
- <div id='method-list'>
45
- <h2>Methods</h2>
46
- <h3>public class</h3>
47
- <ol>
48
- <li><a href="#M000020">new</a></li>
49
- </ol>
50
- <h3>public instance</h3>
51
- <ol>
52
- <li><a href="#M000028">discard</a></li>
53
- <li><a href="#M000023">emit</a></li>
54
- <li><a href="#M000027">keep</a></li>
55
- <li><a href="#M000025">method_missing</a></li>
56
- <li><a href="#M000021">output</a></li>
57
- <li><a href="#M000022">path</a></li>
58
- <li><a href="#M000024">prepare</a></li>
59
- <li><a href="#M000029">rename</a></li>
60
- <li><a href="#M000026">sort</a></li>
61
- <li><a href="#M000030">truncate</a></li>
62
- </ol>
63
- </div>
64
- <div id='section'>
65
- <div id='attribute-list'>
66
- <h2 class='section-bar'>Attributes</h2>
67
- <div class='name-list'>
68
- <table>
69
- <tr class='top-aligned-row context-row'>
70
- <td class='context-item-name'>items</td>
71
- <td class='context-item-value'>[R]</td>
72
- <td class='context-item-desc'></td>
73
- </tr>
74
- <tr class='top-aligned-row context-row'>
75
- <td class='context-item-name'>name</td>
76
- <td class='context-item-value'>[RW]</td>
77
- <td class='context-item-desc'></td>
78
- </tr>
79
- </table>
80
- </div>
81
- </div>
82
- <div id='methods'>
83
- <h2>Public class methods</h2>
84
- <div class='public-class method' id='method-M000020'>
85
- <a name='M000020'> </a>
86
- <div class='synopsis'>
87
- <span class='name'>new</span>
88
- <span class='arguments'>(name, &amp;block)</span>
89
- </div>
90
- <div class='source'>
91
- <a class='source-toggle' href='#' onclick="toggleCode('M000020-source'); return false">
92
- [show source]
93
- </a>
94
- <pre id='M000020-source'> <span class="ruby-comment cmt"># File lib/smoke/origin.rb, line 6</span>&#x000A; 6: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">name</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)&#x000A; 7: <span class="ruby-identifier">raise</span> <span class="ruby-constant">StandardError</span>, <span class="ruby-value str">&quot;Sources must have a name&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">name</span>&#x000A; 8: <span class="ruby-ivar">@name</span> = <span class="ruby-identifier">name</span>&#x000A; 9: <span class="ruby-ivar">@items</span>, <span class="ruby-ivar">@prepare</span>, <span class="ruby-ivar">@transformation</span> = [], [], []&#x000A;10: &#x000A;11: <span class="ruby-identifier">activate!</span>&#x000A;12: <span class="ruby-identifier">instance_eval</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>&#x000A;13: <span class="ruby-keyword kw">end</span></pre>
95
- </div>
96
- </div>
97
- <h2>Public instance methods</h2>
98
- <div class='public-instance method' id='method-M000028'>
99
- <a name='M000028'> </a>
100
- <div class='synopsis'>
101
- <span class='name'>discard</span>
102
- <span class='arguments'>(key, matcher)</span>
103
- </div>
104
- <div class='description'>
105
- <p>
106
- Discard items that do not match the regex
107
- </p>
108
- <p>
109
- Usage (chained):
110
- </p>
111
- <pre>Smoke[:ruby].discard(:title, /tuesday/i)</pre>
112
- <p>
113
- Usage (block, during initialization):
114
- </p>
115
- <pre>Smoke.yql(:ruby) do&#x000A; ...&#x000A; discard(:title, /tuesday/i)&#x000A;end</pre>
116
- </div>
117
- <div class='source'>
118
- <a class='source-toggle' href='#' onclick="toggleCode('M000028-source'); return false">
119
- [show source]
120
- </a>
121
- <pre id='M000028-source'> <span class="ruby-comment cmt"># File lib/smoke/origin.rb, line 140</span>&#x000A;140: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">discard</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">matcher</span>)&#x000A;141: <span class="ruby-ivar">@items</span>.<span class="ruby-identifier">reject!</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> (<span class="ruby-identifier">i</span>[<span class="ruby-identifier">key</span>] <span class="ruby-operator">=~</span> <span class="ruby-identifier">matcher</span>) <span class="ruby-operator">?</span> <span class="ruby-keyword kw">true</span> <span class="ruby-operator">:</span> <span class="ruby-keyword kw">false</span> }&#x000A;142: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>&#x000A;143: <span class="ruby-keyword kw">end</span></pre>
122
- </div>
123
- </div>
124
- <div class='public-instance method' id='method-M000023'>
125
- <a name='M000023'> </a>
126
- <div class='synopsis'>
127
- <span class='name'>emit</span>
128
- <span class='arguments'>(&amp;block)</span>
129
- </div>
130
- <div class='description'>
131
- <p>
132
- Transform each item
133
- </p>
134
- <p>
135
- Usage:
136
- </p>
137
- <pre>emit do&#x000A; rename(:href =&gt; :link)&#x000A;end</pre>
138
- </div>
139
- <div class='source'>
140
- <a class='source-toggle' href='#' onclick="toggleCode('M000023-source'); return false">
141
- [show source]
142
- </a>
143
- <pre id='M000023-source'> <span class="ruby-comment cmt"># File lib/smoke/origin.rb, line 72</span>&#x000A;72: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">emit</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)&#x000A;73: <span class="ruby-ivar">@transformation</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">block</span>&#x000A;74: <span class="ruby-keyword kw">end</span></pre>
144
- </div>
145
- </div>
146
- <div class='public-instance method' id='method-M000027'>
147
- <a name='M000027'> </a>
148
- <div class='synopsis'>
149
- <span class='name'>keep</span>
150
- <span class='arguments'>(key, matcher)</span>
151
- </div>
152
- <div class='description'>
153
- <p>
154
- Keep items that match the regex
155
- </p>
156
- <p>
157
- Usage (chained):
158
- </p>
159
- <pre>Smoke[:ruby].keep(:title, /tuesday/i)</pre>
160
- <p>
161
- Usage (block, during initialization):
162
- </p>
163
- <pre>Smoke.yql(:ruby) do&#x000A; ...&#x000A; keep(:title, /tuesday/i)&#x000A;end</pre>
164
- </div>
165
- <div class='source'>
166
- <a class='source-toggle' href='#' onclick="toggleCode('M000027-source'); return false">
167
- [show source]
168
- </a>
169
- <pre id='M000027-source'> <span class="ruby-comment cmt"># File lib/smoke/origin.rb, line 126</span>&#x000A;126: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">keep</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">matcher</span>)&#x000A;127: <span class="ruby-ivar">@items</span>.<span class="ruby-identifier">reject!</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> (<span class="ruby-identifier">i</span>[<span class="ruby-identifier">key</span>] <span class="ruby-operator">=~</span> <span class="ruby-identifier">matcher</span>) <span class="ruby-operator">?</span> <span class="ruby-keyword kw">false</span> <span class="ruby-operator">:</span> <span class="ruby-keyword kw">true</span> }&#x000A;128: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>&#x000A;129: <span class="ruby-keyword kw">end</span></pre>
170
- </div>
171
- </div>
172
- <div class='public-instance method' id='method-M000025'>
173
- <a name='M000025'> </a>
174
- <div class='synopsis'>
175
- <span class='name'>method_missing</span>
176
- <span class='arguments'>(symbol, *args, &amp;block)</span>
177
- </div>
178
- <div class='source'>
179
- <a class='source-toggle' href='#' onclick="toggleCode('M000025-source'); return false">
180
- [show source]
181
- </a>
182
- <pre id='M000025-source'> <span class="ruby-comment cmt"># File lib/smoke/origin.rb, line 96</span>&#x000A; 96: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">method_missing</span>(<span class="ruby-identifier">symbol</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)&#x000A; 97: <span class="ruby-identifier">ivar</span> = <span class="ruby-node">&quot;@#{symbol}&quot;</span>&#x000A; 98: &#x000A; 99: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">empty?</span>&#x000A;100: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">instance_variable_get</span>(<span class="ruby-identifier">ivar</span>) <span class="ruby-operator">||</span> <span class="ruby-keyword kw">super</span> &#x000A;101: <span class="ruby-keyword kw">else</span>&#x000A;102: <span class="ruby-identifier">instance_variable_set</span>(<span class="ruby-identifier">ivar</span>, <span class="ruby-identifier">args</span>.<span class="ruby-identifier">pop</span>)&#x000A;103: <span class="ruby-keyword kw">end</span>&#x000A;104: &#x000A;105: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>&#x000A;106: <span class="ruby-keyword kw">end</span></pre>
183
- </div>
184
- </div>
185
- <div class='public-instance method' id='method-M000021'>
186
- <a name='M000021'> </a>
187
- <div class='synopsis'>
188
- <span class='name'>output</span>
189
- <span class='arguments'>(type = :ruby)</span>
190
- </div>
191
- <div class='description'>
192
- <p>
193
- Output your items in a range of formats (:ruby, :json and :yaml currently)
194
- Ruby is the default format and will automagically yielded from your source
195
- </p>
196
- <p>
197
- Usage
198
- </p>
199
- <pre>output(:json)&#x000A;=&gt; &quot;[{title: \&quot;Ray\&quot;}, {title: \&quot;Peace\&quot;}]&quot;</pre>
200
- </div>
201
- <div class='source'>
202
- <a class='source-toggle' href='#' onclick="toggleCode('M000021-source'); return false">
203
- [show source]
204
- </a>
205
- <pre id='M000021-source'> <span class="ruby-comment cmt"># File lib/smoke/origin.rb, line 22</span>&#x000A;22: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">output</span>(<span class="ruby-identifier">type</span> = <span class="ruby-identifier">:ruby</span>)&#x000A;23: <span class="ruby-identifier">prepare!</span>&#x000A;24: <span class="ruby-identifier">dispatch</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:dispatch</span>&#x000A;25: <span class="ruby-identifier">output</span> = (<span class="ruby-ivar">@items</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span>) <span class="ruby-operator">?</span> <span class="ruby-ivar">@items</span>.<span class="ruby-identifier">first</span> <span class="ruby-operator">:</span> <span class="ruby-ivar">@items</span>&#x000A;26: &#x000A;27: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">type</span>&#x000A;28: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:json</span>&#x000A;29: <span class="ruby-keyword kw">return</span> <span class="ruby-operator">::</span><span class="ruby-constant">JSON</span>.<span class="ruby-identifier">generate</span>(<span class="ruby-identifier">output</span>)&#x000A;30: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:yaml</span>&#x000A;31: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">YAML</span>.<span class="ruby-identifier">dump</span>(<span class="ruby-identifier">output</span>)&#x000A;32: <span class="ruby-keyword kw">else</span>&#x000A;33: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">output</span>&#x000A;34: <span class="ruby-keyword kw">end</span> &#x000A;35: <span class="ruby-keyword kw">end</span></pre>
206
- </div>
207
- </div>
208
- <div class='public-instance method' id='method-M000022'>
209
- <a name='M000022'> </a>
210
- <div class='synopsis'>
211
- <span class='name'>path</span>
212
- <span class='arguments'>(*path)</span>
213
- </div>
214
- <div class='description'>
215
- <p>
216
- Path allows you to traverse the tree of a the items returned to only give
217
- you access to what you&#8217;re interested in.
218
- </p>
219
- <p>
220
- Usage: path :down, :to, :the, :data
221
- </p>
222
- <p>
223
- Will traverse through a tree as follows:
224
- </p>
225
- <pre>{&#x000A; :down =&gt; {&#x000A; :to =&gt; {&#x000A; :the =&gt; {&#x000A; :data =&gt; []&#x000A; }&#x000A; }&#x000A; }&#x000A;}</pre>
226
- <p>
227
- You will need to help smoke find an array of items that you&#8217;re
228
- interested in.
229
- </p>
230
- </div>
231
- <div class='source'>
232
- <a class='source-toggle' href='#' onclick="toggleCode('M000022-source'); return false">
233
- [show source]
234
- </a>
235
- <pre id='M000022-source'> <span class="ruby-comment cmt"># File lib/smoke/origin.rb, line 62</span>&#x000A;62: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">path</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">path</span>)&#x000A;63: <span class="ruby-ivar">@path</span> = <span class="ruby-identifier">path</span>&#x000A;64: <span class="ruby-keyword kw">end</span></pre>
236
- </div>
237
- </div>
238
- <div class='public-instance method' id='method-M000024'>
239
- <a name='M000024'> </a>
240
- <div class='synopsis'>
241
- <span class='name'>prepare</span>
242
- <span class='arguments'>(&amp;block)</span>
243
- </div>
244
- <div class='description'>
245
- <p>
246
- Prepare is used when you&#8217;d like to provision for arguments /
247
- variables to be set after the source definition. Eg, create a source
248
- definition for twitter, omitting the &#8220;username&#8221;. Set the
249
- username using chaining later.
250
- </p>
251
- <p>
252
- Usage:
253
- </p>
254
- <pre># Definition&#x000A;Smoke.feed :twitter do&#x000A; prepare do&#x000A; url &quot;http://twitter.com/#{username}/rss&quot;&#x000A; end&#x000A;end&#x000A;&#x000A;# End use&#x000A;Smoke[:twitter].username(:benschwarz).output</pre>
255
- </div>
256
- <div class='source'>
257
- <a class='source-toggle' href='#' onclick="toggleCode('M000024-source'); return false">
258
- [show source]
259
- </a>
260
- <pre id='M000024-source'> <span class="ruby-comment cmt"># File lib/smoke/origin.rb, line 91</span>&#x000A;91: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">prepare</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)&#x000A;92: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">&quot;requires a block&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">block_given?</span>&#x000A;93: <span class="ruby-ivar">@prepare</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">block</span>&#x000A;94: <span class="ruby-keyword kw">end</span></pre>
261
- </div>
262
- </div>
263
- <div class='public-instance method' id='method-M000029'>
264
- <a name='M000029'> </a>
265
- <div class='synopsis'>
266
- <span class='name'>rename</span>
267
- <span class='arguments'>(*args)</span>
268
- </div>
269
- <div class='description'>
270
- <p>
271
- Rename one or many keys at a time Suggested that you run it within an each
272
- block, but it makes no difference other than readability
273
- </p>
274
- <p>
275
- Usage
276
- </p>
277
- <pre># Renames all items with a key of href to link&#x000A;rename(:href =&gt; :link)</pre>
278
- <p>
279
- or
280
- </p>
281
- <pre>rename(:href =&gt; :link, :description =&gt; :excerpt)</pre>
282
- </div>
283
- <div class='source'>
284
- <a class='source-toggle' href='#' onclick="toggleCode('M000029-source'); return false">
285
- [show source]
286
- </a>
287
- <pre id='M000029-source'> <span class="ruby-comment cmt"># File lib/smoke/origin.rb, line 154</span>&#x000A;154: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">rename</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)&#x000A;155: <span class="ruby-ivar">@items</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">item</span><span class="ruby-operator">|</span> <span class="ruby-identifier">item</span>.<span class="ruby-identifier">rename</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>) }&#x000A;156: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>&#x000A;157: <span class="ruby-keyword kw">end</span></pre>
288
- </div>
289
- </div>
290
- <div class='public-instance method' id='method-M000026'>
291
- <a name='M000026'> </a>
292
- <div class='synopsis'>
293
- <span class='name'>sort</span>
294
- <span class='arguments'>(key)</span>
295
- </div>
296
- <div class='description'>
297
- <p>
298
- Re-sort items by a particular key
299
- </p>
300
- </div>
301
- <div class='source'>
302
- <a class='source-toggle' href='#' onclick="toggleCode('M000026-source'); return false">
303
- [show source]
304
- </a>
305
- <pre id='M000026-source'> <span class="ruby-comment cmt"># File lib/smoke/origin.rb, line 109</span>&#x000A;109: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sort</span>(<span class="ruby-identifier">key</span>)&#x000A;110: <span class="ruby-ivar">@items</span> = <span class="ruby-ivar">@items</span>.<span class="ruby-identifier">sort_by</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-identifier">i</span>[<span class="ruby-identifier">key</span>] }&#x000A;111: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">NoMethodError</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>&#x000A;112: <span class="ruby-constant">Smoke</span>.<span class="ruby-identifier">log</span>.<span class="ruby-identifier">info</span> <span class="ruby-node">&quot;You're trying to sort by \&quot;#{key}\&quot; but it does not exist in your item set&quot;</span>&#x000A;113: <span class="ruby-keyword kw">ensure</span>&#x000A;114: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>&#x000A;115: <span class="ruby-keyword kw">end</span></pre>
306
- </div>
307
- </div>
308
- <div class='public-instance method' id='method-M000030'>
309
- <a name='M000030'> </a>
310
- <div class='synopsis'>
311
- <span class='name'>truncate</span>
312
- <span class='arguments'>(length)</span>
313
- </div>
314
- <div class='description'>
315
- <p>
316
- Truncate your result set to this many objects
317
- </p>
318
- <p>
319
- Usage
320
- </p>
321
- <pre>truncate(3).output&#x000A;=&gt; [{title =&gt; &quot;Canon&quot;}, {:title =&gt; &quot;Nikon&quot;}, {:title =&gt; &quot;Pentax&quot;}]</pre>
322
- </div>
323
- <div class='source'>
324
- <a class='source-toggle' href='#' onclick="toggleCode('M000030-source'); return false">
325
- [show source]
326
- </a>
327
- <pre id='M000030-source'> <span class="ruby-comment cmt"># File lib/smoke/origin.rb, line 165</span>&#x000A;165: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">truncate</span>(<span class="ruby-identifier">length</span>)&#x000A;166: <span class="ruby-ivar">@items</span> = <span class="ruby-ivar">@items</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span>(<span class="ruby-identifier">length</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>)]&#x000A;167: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>&#x000A;168: <span class="ruby-keyword kw">end</span></pre>
328
- </div>
329
- </div>
330
- </div>
331
- </div>
332
- </div>
333
- </div>
334
- <div id='footer-push'></div>
335
- </div>
336
- <div id='footer'>
337
- <a href="http://github.com/mislav/hanna/tree/master"><strong>Hanna</strong> RDoc template</a>
338
- </div>
339
- </body>
340
- </html>