module Apicraft::Web::Actions
def self.contract(view_path)
def self.contract(view_path) [ File.read(view_path), MIME::Types.type_for(view_path)[0].to_s ] end
def self.images(view_path)
def self.images(view_path) [ File.read(view_path), mime_type(view_path) ] end
def self.mime_type(view_path)
def self.mime_type(view_path) ext = File.extname(view_path) Rack::Mime.mime_type(ext) end
def self.render_erb(view_path)
def self.render_erb(view_path) @vars = { urls: Router.contract_urls, namespace: Router.namespace, version: Apicraft::VERSION } [ ERB.new( File.read(view_path) ).result(binding), "text/html" ] end