Sha256: a608d2bee58daf3944321696dfc29eef5f3599d11585e2793c2cb3357913e374

Contents?: true

Size: 510 Bytes

Versions: 4

Compression:

Stored size: 510 Bytes

Contents

# frozen_string_literal: true

module DeclareSchema
  module Support
    module EvalTemplate
      class << self
        def included(base)
          base.class_eval do
            private

            def eval_template(template_name)
              source  = File.expand_path(find_in_source_paths(template_name))
              context = instance_eval('binding')
              ERB.new(::File.binread(source), trim_mode: '-').result(context)
            end
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
declare_schema-0.1.3 lib/generators/declare_schema/support/eval_template.rb
declare_schema-0.1.2 lib/generators/declare_schema/support/eval_template.rb
declare_schema-0.1.1 lib/generators/declare_schema/support/eval_template.rb
declare_schema-0.1.0 lib/generators/declare_schema/support/eval_template.rb