Skip to content

Commit

Permalink
set #scope rather than #class_name as the preferred method for settin…
Browse files Browse the repository at this point in the history
…g the scope value within a Redistat::Model
  • Loading branch information
jimeh committed Mar 16, 2011
1 parent a983e55 commit 2e2d327
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions lib/redistat/model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ def find_event(event_id)
#

option_accessor :depth
option_accessor :class_name
option_accessor :scope
option_accessor :store_event
option_accessor :hashed_label
option_accessor :label_indexing

alias :scope :class_name
alias :class_name :scope

def connect_to(opts = {})
Connection.create(opts.merge(:ref => name))
Expand All @@ -62,7 +62,7 @@ def connection
alias :redis :connection

def name
options[:class_name] || (@name ||= self.to_s)
options[:scope] || (@name ||= self.to_s)
end

end
Expand Down
2 changes: 1 addition & 1 deletion spec/model_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ class ModelHelper3
class ModelHelper4
include Redistat::Model

class_name "FancyHelper"
scope "FancyHelper"

end
4 changes: 2 additions & 2 deletions spec/model_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
ModelHelper2.depth.should == :day
ModelHelper2.store_event.should == true
ModelHelper2.hashed_label.should == true
ModelHelper2.class_name.should be_nil
ModelHelper2.scope.should be_nil

ModelHelper1.depth.should == nil
ModelHelper1.store_event.should == nil
Expand All @@ -55,7 +55,7 @@
ModelHelper1.store_event.should == nil
ModelHelper1.hashed_label.should == nil

ModelHelper4.class_name.should == "FancyHelper"
ModelHelper4.scope.should == "FancyHelper"
ModelHelper4.send(:name).should == "FancyHelper"
end

Expand Down

0 comments on commit 2e2d327

Please sign in to comment.