Sha256: 49e086d6d937da7602c8dbc6678507be48130e24273b1d7647f2fd2e5ca3f8d0

Contents?: true

Size: 597 Bytes

Versions: 18

Compression:

Stored size: 597 Bytes

Contents

module Ruboty
  module Ragoon
    module Template
      include ::Ruboty::Ragoon::Config

      def render_template(template_name, variables = {})
        template = ::Tilt.new(find_template(template_name))
        template.render(nil, variables)
      end

      def find_template(template_name)
        ragoon_config(:template_dirs).each do |dirname|
          template_file = Dir.glob(File.join(dirname, "#{template_name}*")).first
          return template_file unless template_file.nil?
        end
        raise "Template Missing : #{template_name} is not found"
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
ruboty-ragoon-1.1.0 lib/ruboty/ragoon/template.rb
ruboty-ragoon-1.0.0 lib/ruboty/ragoon/template.rb
ruboty-ragoon-0.8.1 lib/ruboty/ragoon/template.rb
ruboty-ragoon-0.8.0 lib/ruboty/ragoon/template.rb
ruboty-ragoon-0.7.0 lib/ruboty/ragoon/template.rb
ruboty-ragoon-0.6.1 lib/ruboty/ragoon/template.rb
ruboty-ragoon-0.6.0 lib/ruboty/ragoon/template.rb
ruboty-ragoon-0.5.2 lib/ruboty/ragoon/template.rb
ruboty-ragoon-0.5.1 lib/ruboty/ragoon/template.rb
ruboty-ragoon-0.5.0 lib/ruboty/ragoon/template.rb
ruboty-ragoon-0.4.0 lib/ruboty/ragoon/template.rb
ruboty-ragoon-0.3.1 lib/ruboty/ragoon/template.rb
ruboty-ragoon-0.3.0 lib/ruboty/ragoon/template.rb
ruboty-ragoon-0.2.1 lib/ruboty/ragoon/template.rb
ruboty-ragoon-0.2.0 lib/ruboty/ragoon/template.rb
ruboty-ragoon-0.1.2 lib/ruboty/ragoon/template.rb
ruboty-ragoon-0.1.1 lib/ruboty/ragoon/template.rb
ruboty-ragoon-0.1.0 lib/ruboty/ragoon/template.rb