Created
February 12, 2017 22:29
-
-
Save bryanp/6bd53043c703629f51edc681a8015260 to your computer and use it in GitHub Desktop.
Pakyow 1.0 Loader Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Pakyow | |
class App | |
load :resources, with: Loaders::Resource | |
end | |
module Loaders | |
class Resource < Base | |
location :resources | |
def initialize(filename, resource) | |
@filename = filename | |
@resource = resource | |
# warn if @resource.name does not match @filename | |
# | |
# we could error here, but a warning seems to make more sense | |
# given that everything will work fine (we don't infer meaning | |
# from the filename) but we would prefer that the naming | |
# convention used makes good sense | |
end | |
def valid? | |
# valdate that: | |
# @resource is a Router subclass | |
# @resource expanded the resource template | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment