http://guides.rubygems.org/make-your-own-gem/ http://www.intridea.com/blog/2012/3/8/polishing-rubies-part-ii
gem yank my-gem -v0.0.0
--Before pushing a new version of a gem... change version number in gemspec
bundle git add . git status git commit
http://guides.rubygems.org/make-your-own-gem/ http://www.intridea.com/blog/2012/3/8/polishing-rubies-part-ii
gem yank my-gem -v0.0.0
--Before pushing a new version of a gem... change version number in gemspec
bundle git add . git status git commit
From https://github.com/beeminder/beeminder-gem/blob/master/lib/beeminder.rb
# local libs
Dir["#{File.join(File.dirname(__FILE__), "beeminder")}/*.rb"].each do |lib|
require lib
end| def fibonacci(n) | |
| if (0..1) === n | |
| n | |
| else | |
| fibonacci(n-1) + fibonacci(n-2) | |
| end | |
| end | |
| def prime_list(highest) | |
| list = Array.new(highest, true) |
In class definitions,
attr_accessor :name, :email, :phone_numberis the same as
attr_reader :name, :email, :phone_numberThe first thing that really surprised me today was the flexibility of Ruby's shovel operator, <<. A student in the class had tried the following:
a = [0]
a << aWhat do you think a is now? I was sure it would be [0, [0]]. But lo and behold, Ruby sparkles;
a = [0]
a << a