Welcome! This page is using CodeRay 1.1.2.
We currently have
3063 rays
in the database.
You can add a
New Ray
or browse the posted rays by pages.
Ruby test |
12 lines
of
Ruby
|
285 Bytes |
Show |
Edit |
Expand |
1
2
3
4
5
6
7
8
9
10 |
source 'https://rubygems.org'
gem 'nokogiri'
gem 'rack', '~>1.1'
group :test, :development do
gem 'rspec'
end
gem 'some_local_gem', :path => '/local/gem/path' if 1 < 2
gem '... |
|
Ruby test |
12 lines
of
Ruby
|
276 Bytes |
Show |
Edit |
Expand |
1
2
3
4
5
6
7
8
9
10 |
source 'https://rubygems.org'
gem 'nokogiri'
gem 'rack', '~>1.1'
group :test, :development do
gem 'rspec'
end
gem 'some_local_gem', :path => '/local/gem/path'
gem 'gem_hoste... |
|
Ruby test |
8 lines
of
Ruby
|
139 Bytes |
Show |
Edit |
Expand |
1
2
3
4
5
6
7
8 |
source 'https://rubygems.org'
gem 'nokogiri'
gem 'rack', '~>1.1'
gem 'rspec', :require => 'spec'
|
|
Ruby test |
11 lines
of
Ruby
|
284 Bytes |
Show |
Edit |
Expand |
1
2
3
4
5
6
7
8
9 |
task :turn_off_alarm do
puts "Turned off alarm"
end
task :make_coffee do
cups = ENV["COFFEE_CUPS"] || 2
puts "Made #{cups} cups of coffee."
end
task :ready_for_the_day => [:tur... |
|
Ruby test |
13 lines
of
Ruby
|
318 Bytes |
Show |
Edit |
Expand |
1
2
3
4
5
6
7
8
9
10
11 |
task :turn_off_alarm do
puts "Turned off alarm"
end
task :make_coffee do
cups = ENV["COFFEE_CUPS"] || 2
puts "Made #{cups} cups of coffee."
end
task... |
|
Ruby test |
42 lines
of
Ruby
|
577 Bytes |
Show |
Edit |
Expand |
1
2
3
4
5
6
7
8
9
10
11
12 |
h = Hash[:key1, 'value1', :key2, 'value2']
h = {key1 : ‘value1’, key2 : ‘value2’}
a = Array.new(); a << 1; a << 2;
a = [0,2,3]
class SomeClass
end
SomeClass = Class.new do
... |
|
Ruby test |
42 lines
of
Ruby
|
491 Bytes |
Show |
Edit |
Expand |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 |
h = Hash.new
h = {}
a = Array.new
a = []
class SomeClass
end
SomeClass = Class.new do
end
class MyHash < Hash
end
MyHash = Class.new(MyHash) do
... |
|
Ruby test |
7 lines
of
Ruby
|
117 Bytes |
Show |
Edit |
Expand |
1
2
3
4
5
6
7 |
class Test
def some_method
puts "doing stuff...no bigs"
end
end
a_method = Test.method(:some_method) |
|
Ruby test |
19 lines
of
Ruby
|
280 Bytes |
Show |
Edit |
Expand |
1
2
3
4
5
6
7
8
9
10
11
12
13 |
"string instance".object_id
"string instance".class
"string instance".object_id
"string instance".class
:symbol_instance.object_id
:symbol_instance.class
5.object_id
5.class
String.... |
|
Workout log |
33 lines
of
Ruby
by
Ahmed
|
962 Bytes |
Show |
Edit |
Expand |
1
2
3
4 |
class WorkoutLog
attr_accessor :name, :current_weight,:date, :gym, :duration, :muscle_group
attr_reader :total_exersises
def initialize(name, current_weight, date, gym, duration, muscle_gr... |
|