Initial Sinatra project strucutre

This commit is contained in:
2022-12-07 17:52:27 -05:00
parent b5a8889349
commit 6dd3e4c7d6
12 changed files with 206 additions and 7 deletions

20
lib/config.rb Normal file
View File

@ -0,0 +1,20 @@
require 'yaml'
class Config
def initialize(config_path)
@data = YAML::load_file(config_path)
end
def get(key, depth = 0)
bits = key.split('.')
value = @data
bits.each do |bit|
value = value[bit]
end
return value
end
end

5
lib/models/item.rb Normal file
View File

@ -0,0 +1,5 @@
class Item < Sequel::Model
end

7
lib/routes.rb Normal file
View File

@ -0,0 +1,7 @@
get '/' do
items = Item.all
erb :index, :locals => {
:title => 'Dashboard',
:items => items
}
end