Prefer Enumerable#detect over Enumerable#select.first (#147)

This commit is contained in:
Akshay Birajdar
2019-10-15 11:46:18 +05:30
committed by Pranav Raj S
parent 01b72ca051
commit 4bb6842a4d

View File

@@ -60,7 +60,7 @@ class Plan
end
def trial_plan
all_plans.select { |plan| plan.key == :trial }.first
all_plans.detect { |plan| plan.key == :trial }
end
def plans_of_version(version)
@@ -69,7 +69,7 @@ class Plan
def find_by_key(key)
key = key.to_sym
all_plans.select { |plan| plan.key == key }.first.dup
all_plans.detect { |plan| plan.key == key }.dup
end
##helpers