module Tux::Commands
Constants
- SETTINGS
Public Instance Methods
app()
click to toggle source
# File lib/tux/commands.rb, line 21 def app @app ||= begin obj = Tux.app_class.new! obj.request = Sinatra::Request.new({}) obj.response = Sinatra::Response.new obj end end
routes()
click to toggle source
# File lib/tux/commands.rb, line 5 def routes Tux.app_class.routes.inject([]) {|arr, (k,v)| arr += v.map {|regex,params,*| path = params.empty? ? regex.inspect : params.inject(regex.inspect) {|s,e| s.sub(/\([^()]+\)/, ":#{e}") } [k, (str = path[%r{/\^(.*)\$/}, 1]) ? str.tr('\\', '') : path] } } end
settings()
click to toggle source
# File lib/tux/commands.rb, line 15 def settings meths = (Tux.app_class.methods(false) + Sinatra::Base.methods(false)). sort.map(&:to_s).select {|e| e[/=$/] }.map {|e| e[0..-2] } - SETTINGS meths.map {|meth| [meth, (Tux.app_class.send(meth) rescue $!.inspect)] } end