Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Pakyow 1.0 Loader Example
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