module WSOC::Course

Public Class Methods

course_pass(path) click to toggle source

Adds a path to the Obstacle Course.

@param [String] path

The path to add to the obstacle course.

@since 0.1.0

# File lib/wsoc/course.rb, line 61
def self.course_pass(path)
  get(path) do
    erb :course_pass, :layout => false
  end
end
course_template(path) click to toggle source

Adds a path to the Obstacle Course, where a course template will be rendered.

@param [String] path

The path to add to the obstacle course.

@since 0.1.0

# File lib/wsoc/course.rb, line 45
def self.course_template(path)
  name = path[1..-1].gsub(/\.\S*$/,'').gsub(/\/+/,'_').to_sym

  get(path) do
    erb name, :layout => false
  end
end
included(base) click to toggle source
# File lib/wsoc/course.rb, line 25
def self.included(base)
  base.module_eval do
    set :host, Config::DEFAULT_HOST
    set :port, Config::DEFAULT_PORT

    set :root, File.expand_path(File.join(File.dirname(__FILE__),'..','..'))
    set :course, File.join(self.root,'course')
    enable :static, :sessions

    helpers WSOC::Helpers

    #
    # Adds a path to the Obstacle Course, where a course template
    # will be rendered.
    #
    # @param [String] path
    #   The path to add to the obstacle course.
    #
    # @since 0.1.0
    #
    def self.course_template(path)
      name = path[1..-1].gsub(/\.\S*$/,'').gsub(/\/+/,'_').to_sym

      get(path) do
        erb name, :layout => false
      end
    end

    #
    # Adds a path to the Obstacle Course.
    #
    # @param [String] path
    #   The path to add to the obstacle course.
    #
    # @since 0.1.0
    #
    def self.course_pass(path)
      get(path) do
        erb :course_pass, :layout => false
      end
    end
  end
end