Ruby
Jump to navigation
Jump to search
Basics
- Ruby is a dynamic, open source programming language with a focus on simplicity and productivity. It has an elegant syntax that is natural to read and easy to write.
# The Greeter class class Greeter def initialize(name) @name = name.capitalize end def salute puts "Hello #{@name}!" end end # Create a new object g = Greeter.new("world") # Output "Hello World!" g.salute
Guides
- http://en.wikipedia.org/wiki/Why%27s_(poignant)_Guide_to_Ruby
- The Bastards Book of Ruby
- https://practicingruby.com/
Gems
Guides
- isitruby1.9 Community-powered gem compatibility for ruby 1.9]
Setup
install ruby rubygems
Installing Gems
gem install [rubygem] install a gem gem upgrade upgrade installed gems gem env
As user, goes into .gem. As root, goes into /usr/lib/ruby/gems/1.9.1/gems/compass-0.11.7/frameworks/compass/stylesheets/compass or suchlike.
ruby -r rubygems -e "p Gem.path" display ruby gem path[s]
to sort
Tools
- RVM is a command-line tool which allows you to easily install, manage, and work with multiple ruby environments from interpreters to sets of gems.
Shoes
Development
- http://rubygems.org/gems/css_parser - stats on css output from sass, etc.
- jim - jim is your friendly javascript library manager. He downloads, stores, bundles, vendors and compresses.
Sinatra
require 'sinatra' get '/hi' do "Hello World!" end
gem install sinatra ruby hi.rb