From e5fcd982474253d471697f711c9df9d3f07030fd Mon Sep 17 00:00:00 2001 From: Jonathan Rudenberg Date: Mon, 17 Sep 2012 12:06:20 -0400 Subject: [PATCH] Don't use a constant for api data --- lib/api_example.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/api_example.rb b/lib/api_example.rb index 18c3cb6..bcbb26c 100644 --- a/lib/api_example.rb +++ b/lib/api_example.rb @@ -4,7 +4,9 @@ class ApiExampleFilter < Nanoc::Filter identifier :api_example type :text - DATA = YAML.load(File.read('content/docs/api_examples.yaml')) + def initialize(*args) + @data = YAML.load(File.read('content/docs/api_examples.yaml')) + end def run(content, params={}) content.gsub(/\{(\w+) example\}/) { api_example($1) }.gsub(/\{(\w+) var\}/) { api_var($1) } @@ -13,10 +15,10 @@ class ApiExampleFilter < Nanoc::Filter private def api_example(id) - DATA[:examples][id.to_sym] + @data[:examples][id.to_sym] end def api_var(id) - DATA[:variables][id.to_sym] + @data[:variables][id.to_sym] end end