"I wanted a scripting language that was more powerful than Perl, and more object-oriented than Python. That's why I decided to design my own language."
(Yokihiro "Matz" Matsumoto)
"I hope to see Ruby help every programmer in the world to be productive, and to enjoy programming, and to be happy. That is the primary purpose of Ruby language."
(Yokihiro "Matz" Matsumoto)
puts -199.abs #=> 199 puts 'Chunky Bacon!'.length #=> 13 puts 'ruby is cool.'.index 'u' #=> 1 puts %q{Nice Day Isn't It?}.downcase.split('').uniq.sort.join #=> ' ?acdeinsty
class Fixnum def + other self - other end end p 5 + 3 #=> 2 p 5.+(3) #=> 2
def foo 'klar!' end if a = foo puts a end b = if true 'natürlich!' end puts b puts 'klar' if true
(1..100).each do |i| puts i end
def double &block block.call block.call end double do puts 'Hi!' #=> Hi! end #=> Hi!
describe MySum do it "performs a sum" do sum = MyClass.add 1, 1 sum.should == 2 end end
require 'sinatra' get '/hi' do 'Hello World!' end
doc 'The schedule of a single station grouped by playlists.' doc :example, 'http://HOSTNAME/station/deepgroove/playlists' doc :parameters, {station_name: '[\w\d_\-]+'} doc :key, '/station/{station_name}/playlists' get %r{\A/station/([\w\d_\-]+)/playlists\Z} do |name| expires schedule_expiration, :public, :must_revalidate RedisStore::Playlists.find(name) end
task default: :test desc 'Run all the tests' task :test do ruby "test/unittest.rb" end
source 'http://rubygems.org' gem 'sinatra', '~> 0.9.0' gem 'rack-cache' gem 'rack-bug' gem 'lautfm_utils', '>= 0.0.23', path: '/Users/niko/laut/lautfm_utils' gem 'ad_machine', '>= 0.2.9', :git => 'git@github.com:lautde/ad_machine.git'
set :application, 'www' set :deploy_to, '/export/webroot/www' set :user, 'laut' set :scm, :git set :repository, 'git@github.com:lautde/laut.fm-V2.git' set :branch, 'master' namespace :deploy do task :restart_daemons, roles: :web do ... end after 'deploy', 'deploy:restart_daemons' end