From 522c23b206530507c1f291db4e8b2abd8a72074b Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Mon, 30 Oct 2017 00:22:00 -0400 Subject: [PATCH] Greenhouse: Simple Rack application --- lib/sapling/greenhouse.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 lib/sapling/greenhouse.rb diff --git a/lib/sapling/greenhouse.rb b/lib/sapling/greenhouse.rb new file mode 100644 index 0000000..cf88e19 --- /dev/null +++ b/lib/sapling/greenhouse.rb @@ -0,0 +1,15 @@ +require 'erb' + +# The rack application +class Greenhouse + attr_reader :tree + + def initialize(file) + @tree = file + @response = ERB.new(File.read('lib/sapling/index.erb')).result(binding) + end + + def call(_env) + ['200', { 'Content-Type' => 'text/html' }, [@response]] + end +end