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.
- Pry is a powerful alternative to the standard IRB shell for Ruby. It features syntax highlighting, a flexible plugin architecture, runtime invocation and source and documentation browsing.
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
CMS/F
Mobile apps
Other
- http://docs.topazruby.com/en/latest/ - ruby on python
JavaScript
- Opal is a ruby to javascript compiler. It is source-to-source, making it fast as a runtime. Opal includes a compiler (which can be run in any browser), a corelib and runtime implementation. The corelib/runtime is also very small (10.8kb gzipped).
- RubyJS is a JavaScript implementation of all methods from Ruby classes like Array, String, Numbers, Time and more.