Skip to content

Commit 1587d91

Browse files
committed
Add some before/after comparisons
1 parent facaad6 commit 1587d91

19 files changed

+58
-0
lines changed

1-value-objects/1_constant.rb

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
class Constant < ActiveRecord::Base
2+
3+
def better_than?(other)
4+
rating > other.rating
5+
end
6+
7+
def rating
8+
if remediation_cost <= 2
9+
"A"
10+
elsif remediation_cost <= 4
11+
"B"
12+
elsif remediation_cost <= 8
13+
"C"
14+
elsif remediation_cost <= 16
15+
"D"
16+
else
17+
"F"
18+
end
19+
end
20+
21+
end

2-service-objects/1_user.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class User < ActiveRecord::Base
2+
# ...
3+
4+
def authenticate(unencrypted_password)
5+
if BCrypt::Password.new(password_digest) == unencrypted_password
6+
self
7+
else
8+
false
9+
end
10+
end
11+
end
File renamed without changes.

3-form-objects/1_signups_controller.rb

Whitespace-only changes.

4-query-objects/1_account.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
class Account < ActiveRecord::Base
2+
# ...
3+
4+
def self.abandoned_trials
5+
where(plan: nil, invites_count: 0)
6+
end
7+
8+
end
File renamed without changes.

0 commit comments

Comments
 (0)