Use attr_reader instead of instance variables

This commit is contained in:
Matija Čupić 2017-11-28 14:36:12 +01:00
parent 6f72039007
commit 899a80955c
No known key found for this signature in database
GPG Key ID: 4BAF84FFACD2E5DE
1 changed files with 4 additions and 4 deletions

View File

@ -1,6 +1,4 @@
class ClustersFinder
attr_reader :project, :user, :scope
def initialize(project, user, scope)
@project = project
@user = user
@ -14,8 +12,10 @@ class ClustersFinder
private
attr_reader :project, :user, :scope
def filter_by_scope(clusters)
case @scope.to_sym
case scope.to_sym
when :all
clusters
when :inactive
@ -23,7 +23,7 @@ class ClustersFinder
when :active
clusters.enabled
else
raise "Invalid scope #{@scope}"
raise "Invalid scope #{scope}"
end
end
end