Skip to content

Instantly share code, notes, and snippets.

@mariozig
Last active December 11, 2015 01:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mariozig/4521568 to your computer and use it in GitHub Desktop.
Save mariozig/4521568 to your computer and use it in GitHub Desktop.
Example for proving that Sublime Text 2 is running through RVM ruby and not the system default ruby. Goes with: http://ruby.zigzo.com/2013/01/11/sublime-text-2-and-rvm/
class Factorial
attr_reader :computed
def initialize(number)
@computed = solve(number)
end
def solve(number)
number > 1 ? number * solve(number-1) : 1
end
end
puts "5! = #{Factorial.new(5).computed}"
puts "And your ruby version is #{RUBY_VERSION}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment