Sha256: fec40236a10c762534c7894be9c63e3b62578a28a76bc92dca58d5eaf535db4b

Contents?: true

Size: 1017 Bytes

Versions: 24

Compression:

Stored size: 1017 Bytes

Contents

# Copyright (C) 2016-2023  Sutou Kouhei <kou@clear-code.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

module Grntest
  class TemplateEvaluator
    def initialize(template)
      @template = template
    end

    def evaluate(**local_variables)
      _binding = binding
      local_variables.each do |name, value|
        _binding.local_variable_set(name, value)
      end
      _binding.eval(@template)
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
grntest-1.8.0 lib/grntest/template-evaluator.rb
grntest-1.7.9 lib/grntest/template-evaluator.rb
grntest-1.7.8 lib/grntest/template-evaluator.rb
grntest-1.7.7 lib/grntest/template-evaluator.rb
grntest-1.7.6 lib/grntest/template-evaluator.rb
grntest-1.7.5 lib/grntest/template-evaluator.rb
grntest-1.7.4 lib/grntest/template-evaluator.rb
grntest-1.7.3 lib/grntest/template-evaluator.rb
grntest-1.7.2 lib/grntest/template-evaluator.rb
grntest-1.7.1 lib/grntest/template-evaluator.rb
grntest-1.7.0 lib/grntest/template-evaluator.rb
grntest-1.6.9 lib/grntest/template-evaluator.rb
grntest-1.6.8 lib/grntest/template-evaluator.rb
grntest-1.6.7 lib/grntest/template-evaluator.rb
grntest-1.6.6 lib/grntest/template-evaluator.rb
grntest-1.6.5 lib/grntest/template-evaluator.rb
grntest-1.6.4 lib/grntest/template-evaluator.rb
grntest-1.6.3 lib/grntest/template-evaluator.rb
grntest-1.6.2 lib/grntest/template-evaluator.rb
grntest-1.6.1 lib/grntest/template-evaluator.rb