diff --git a/binlib/sql/template.rb b/binlib/sql/template.rb index 2d6a2b9..8230e49 100644 --- a/binlib/sql/template.rb +++ b/binlib/sql/template.rb @@ -7,8 +7,7 @@ class SQL::Template def context context = binding - context.local_variable_set(:languages, %w[ar en pt fa].map { SQL::Language.new(_1) }) - context.local_variable_set(:chapter_id, 1) + locals.each { context.local_variable_set(_1, _2) } context end @@ -26,4 +25,13 @@ class SQL::Template chapter_id, verse.content ].map { Integer === _1 ? _1 : SQL::Utils.escape(_1) }.join(",") end + + private + + def locals + { + languages: %w(ar en pt fa).map { SQL::Language.new(_1) }, + chapter_id: 1 + } + end end