class AlittleLess

Constants

DB_CONF

Public Class Methods

add_action(verb, action, block) click to toggle source
# File lib/a_little_less.rb, line 75
def add_action verb, action, block
    controllers[ self.to_s.decamelize ][ verb ][ action.to_s ] = block
end
alias_name(name) click to toggle source
# File lib/a_little_less.rb, line 68
def alias_name name
    name = name.to_s
    main_name = self.to_s.decamelize
    if name != main_name
        alias_name_map[name] = main_name
    end
end
alias_name_map() click to toggle source
# File lib/a_little_less.rb, line 47
def alias_name_map
    @@alias_name_map
end
controllers() click to toggle source
# File lib/a_little_less.rb, line 44
def controllers
    @@controllers
end
default_controller() click to toggle source
# File lib/a_little_less.rb, line 62
def default_controller
    @@default_controller = self.to_s.decamelize
end
delete(action, █) click to toggle source
# File lib/a_little_less.rb, line 82
def delete  action, █ add_action __method__, action, block; end
env() click to toggle source
# File lib/a_little_less/env.rb, line 22
def self.env
    @all_env ||= Env.new ENV['ALL_ENV']
end
get(action, █) click to toggle source
# File lib/a_little_less.rb, line 78
def get     action, █ add_action __method__, action, block; end
get_default_controller() click to toggle source
# File lib/a_little_less.rb, line 65
def get_default_controller
    @@default_controller
end
head(action, █) click to toggle source
# File lib/a_little_less.rb, line 83
def head    action, █ add_action __method__, action, block; end
inherited(subclass) click to toggle source
# File lib/a_little_less.rb, line 50
def inherited subclass
    controllers[subclass.to_s.decamelize] = {
        get: {
            # action_name string => action proc
        },
        head: {}, # head is the same as get, but doesn`t return body
        post: {},
        patch: {},
        put: {},
        delete: {}
    }
end
new(req) click to toggle source

RackApp entry point

# File lib/a_little_less.rb, line 88
def initialize req
    @req = req
end
patch(action, █) click to toggle source
# File lib/a_little_less.rb, line 80
def patch   action, █ add_action __method__, action, block; end
post(action, █) click to toggle source
# File lib/a_little_less.rb, line 79
def post    action, █ add_action __method__, action, block; end
put(action, █) click to toggle source
# File lib/a_little_less.rb, line 81
def put     action, █ add_action __method__, action, block; end
rack_app() click to toggle source
# File lib/a_little_less/rack_app.rb, line 166
def self.rack_app
    RackApp
end

Public Instance Methods

conversation!() click to toggle source
# File lib/a_little_less.rb, line 92
def conversation!
    if http_options? and http_origin_allowed?
        set_options_response
        add_default_cors_headers
        return
    end

    if route = search_route
        # logi "route found: #{route.klass} #{route.action_proc}"
        action_please! route
        add_default_cors_headers
    else
        # logi 'route not found'
        not_found
    end
end