From 2e2d3273cc7dfba212a932368809f149c6b2321f Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Wed, 16 Mar 2011 00:56:59 +0000 Subject: [PATCH] set #scope rather than #class_name as the preferred method for setting the scope value within a Redistat::Model --- lib/redistat/model.rb | 6 +++--- spec/model_helper.rb | 2 +- spec/model_spec.rb | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/redistat/model.rb b/lib/redistat/model.rb index 049c784..f1fa4f1 100644 --- a/lib/redistat/model.rb +++ b/lib/redistat/model.rb @@ -39,12 +39,12 @@ module Redistat # 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)) @@ -62,7 +62,7 @@ module Redistat alias :redis :connection def name - options[:class_name] || (@name ||= self.to_s) + options[:scope] || (@name ||= self.to_s) end end diff --git a/spec/model_helper.rb b/spec/model_helper.rb index b0cfb24..4328052 100644 --- a/spec/model_helper.rb +++ b/spec/model_helper.rb @@ -25,6 +25,6 @@ end class ModelHelper4 include Redistat::Model - class_name "FancyHelper" + scope "FancyHelper" end \ No newline at end of file diff --git a/spec/model_spec.rb b/spec/model_spec.rb index 6c607e6..347bfd9 100644 --- a/spec/model_spec.rb +++ b/spec/model_spec.rb @@ -37,7 +37,7 @@ describe Redistat::Model do 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 @@ -55,7 +55,7 @@ describe Redistat::Model do 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