-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadvruby.rb
More file actions
117 lines (65 loc) · 1.04 KB
/
advruby.rb
File metadata and controls
117 lines (65 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
class String
def wazzzupify
return "wazzup"
end
end
s = "Hello"
puts s.length
# send
# s = "Hello"
# puts s.send(:upcase)
# class ActiveRecord::Base
# def method_missing(m, *args)
# if m.starts_with?("find_by_")
# end
# # ...
# end
# end
# class Sport < ActiveRecord::Base
# end
# s = Sport.find_by_name("Hockey")
# puts s.season
# A terminal-based calculator
# loop do
# input = gets.chomp
# p eval(input)
# end
# Loops
# for i in [1,3,5]
# puts i
# end
# i = 1
# while (i < 6)
# puts i
# i += 2
# end
# loop do
# puts "Hello"
# break
# end
# puts "Goodbye"
# Lambdas:
# f = lambda { |greeting| puts greeting }
# f.call("Wazzzup")
# Javascript
# var f = function() {
# alert("Hello");
# }
#
# f()
# class Player
# attr_accessor :name
# def jersey
# puts self
# puts self.name
# return 21
# end
# def self.all
# puts self
# ["Jeff", "Mike", "Neal"]
# end
# end
# jeff = Player.new
# jeff.name = "Jeff"
# puts jeff.jersey
# puts Player.all