From 8c199c4d620e78edb0c0dd028fc2940f08deab56 Mon Sep 17 00:00:00 2001 From: Bryan Woods Date: Fri, 18 Dec 2015 11:43:17 -0500 Subject: [PATCH 1/3] You must now load active_support --- lib/redness.rb | 1 + spec/spec_integration_helper.rb | 1 + 2 files changed, 2 insertions(+) diff --git a/lib/redness.rb b/lib/redness.rb index f6fd411..ca0fc40 100644 --- a/lib/redness.rb +++ b/lib/redness.rb @@ -1,5 +1,6 @@ require "json" unless defined?(JSON) require "redis" unless defined?(Redis) +require "active_support" require "active_support/core_ext" unless defined?(ActiveSupport) require "precisionable" diff --git a/spec/spec_integration_helper.rb b/spec/spec_integration_helper.rb index d3ffde3..3a17379 100644 --- a/spec/spec_integration_helper.rb +++ b/spec/spec_integration_helper.rb @@ -3,6 +3,7 @@ require 'rspec' require 'redis' +require 'active_support' require 'active_support/core_ext' require 'timecop' From ce7808f6adb9b36e72f4a0a6b1544ce9a67c4a24 Mon Sep 17 00:00:00 2001 From: Bryan Woods Date: Fri, 18 Dec 2015 11:47:33 -0500 Subject: [PATCH 2/3] Adds swap files to the gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 326ed4f..d9df82d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /Gemfile.lock *.gem +*.sw[o,p] tmp/* From 0f7560d5161ad39e27f8ff6638b01508540f0a67 Mon Sep 17 00:00:00 2001 From: Bryan Woods Date: Fri, 18 Dec 2015 11:47:48 -0500 Subject: [PATCH 3/3] Implements RedCappedList#get_strings --- lib/redness/red_capped_list.rb | 4 ++++ spec/redness/red_capped_list_spec.rb | 14 ++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/lib/redness/red_capped_list.rb b/lib/redness/red_capped_list.rb index 623e6bc..51ad4fc 100644 --- a/lib/redness/red_capped_list.rb +++ b/lib/redness/red_capped_list.rb @@ -10,6 +10,10 @@ def get RedList.get(key) end + def get_strings + RedList.get_strings(key) + end + def add(value) RedList.add(key, value) RedList.trim_to(key, cap) diff --git a/spec/redness/red_capped_list_spec.rb b/spec/redness/red_capped_list_spec.rb index 979768d..4a10e00 100644 --- a/spec/redness/red_capped_list_spec.rb +++ b/spec/redness/red_capped_list_spec.rb @@ -16,6 +16,20 @@ end end + describe "#get_strings" do + it "returns the string values of the list at the key" do + r = RedCappedList.new("somekey", 2) + + r.get_strings.should == [] + + r.add("foo") + r.add("bar") + r.add("baz") + + r.get_strings.should == ["baz", "bar"] + end + end + describe "#add" do it "adds to the list at the key" do r = RedCappedList.new("somekey", 1000)