Tuesday, January 21, 2014

Day4 WeBrand Ruby Standard Library abbrev

Day 4 was an abort mission. Kurtis and I met at Cafe Primo while Kevin & Brandon were away at Sundance. The internet was too slow to work there so Kurtis told me to take the rest of the day off and to play with the Ruby Standard library.

It took me several days and a mini melt down to figure out how to do that. Finally on Monday after going back to Learn Ruby the Hard Way exercise 12 I realized that all you have to do is open a new whatever.rb file and require the gem then you can screw around with it.

I looked up documentation on the abbrev gem. Here are some good links:
http://endofline.wordpress.com/2010/12/25/ruby-standard-library-abbrev/
http://www.aimred.com/news/developers/2010/05/11/rediscovering_ruby_abbrev/

I called the method .abbrev on a the string "elephant" and it returned:
eelephantelephanelephantelephantelephanteleelephantelephelephantelephaelephantelepelephantelelephant
broken into lines it looks like this:
e
elephant
elephan
elephant
elephant
elephant
ele
elephant
eleph
elephant
elepha
elephant
elep
elephant
elelephant


$ gem search -r post_install
*** REMOTE GEMS ***
post_install (0.0.2)

$ gem search -i post_install # installed?
false

Gems
http://net.tutsplus.com/tutorials/ruby/ruby-for-newbies-working-with-gems/

I didn't realize that rails is a gem. Wow.

Tutorials:
http://net.tutsplus.com/sessions/ruby-for-newbies/

https://www.ruby-toolbox.com/

http://guides.rubygems.org/

https://www.ruby-lang.org/en/libraries/

No comments:

Post a Comment