summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2017-04-06 01:16:16 +0000
committerbrian m. carlson <sandals@crustytoothpaste.net>2017-04-06 01:16:16 +0000
commit24d77bcd87f1c5074b5a478fc8ed131d3c20cb20 (patch)
tree7dddb31948730b888d35850d2d81b347ab9c305e
parentaa847c6bbff9410cecdf16f61a9a2a993ed809f7 (diff)
comics/data: avoid holding on to config object
Since we don't need to pull arbitrary data from the config object, only the tag prefix, do that in the constructor. That allows the code to be easier to test in the future if we want to use mock objects. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
-rw-r--r--lib/comics/data.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/comics/data.rb b/lib/comics/data.rb
index 61bb91b..d3d3a13 100644
--- a/lib/comics/data.rb
+++ b/lib/comics/data.rb
@@ -69,7 +69,7 @@ module Comics
attr_reader :tag, :updatetime
def initialize(config, tag, data, defaults)
- @config = config
+ @tag_prefix = config.tag_prefix
@tag = tag
@data = data
@defaults = defaults
@@ -109,7 +109,7 @@ module Comics
end
def id_for(type, date)
- IDGenerator.generate(@config.tag_prefix, type, @tag, date.strftime('%F'))
+ IDGenerator.generate(@tag_prefix, type, @tag, date.strftime('%F'))
end
def latest