Sha256: b9fbc3f30ff09b5477ed0b87cde0b305f2ffed7295eb278aaeb6eb210fc92ed0

Contents?: true

Size: 785 Bytes

Versions: 1

Compression:

Stored size: 785 Bytes

Contents

module Milksteak
  class Cms
    @@pages = []
    @routes = nil

    def initialize(app)
      @app = app
    end

    def call(env)
      dup._call(env)
    end
    
    def load_pages
      @@pages = []
      Milksteak::Page.list.each do |name|
        name = name.match(/^.+\/(.+)\.yml/)[1]
        page = Milksteak::Page.load(name, "r")
        @@pages << page
      end
    end
  
    # todo: test
    def routes
      return @routes if @routes
      @routes = { :primary => [], :dynamic => [] }
      @@pages.each do |page|
        
      end
      return @routes
    end  

    def route(url)
      # TODO
    end
  
    def _call(env)
      #puts "OK"
      @status, @headers, @response = @app.call(env)
      [@status, @headers, @response]
    end
  end
  
  # todo: test
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
milksteak-0.0.6 lib/milksteak/cms.rb