Sha256: e1d902fe14a4b0e09bd834813b53d0dc9c9f2d0b6d813e406169e487b7971c4d
Contents?: true
Size: 1.31 KB
Versions: 2
Compression:
Stored size: 1.31 KB
Contents
require 'active_model/serialization' require 'active_model/serializers/xml' # for Hash.to_xml require 'active_support/inflector' require 'active_support/inflector/inflections' require 'active_support/core_ext/hash/slice' # for Hash.slice require 'json' require 'yaml' require 'sinatra' require 'sinatra/reloader' $: << File.dirname(__FILE__) << File.dirname(File.dirname(__FILE__)) require 'config/defaults' require "app/routes/get/config" require "app/routes/get/objects" require "app/routes/get/status" require "app/routes/put" require "app/routes/put/status" # # environment file must go after default, some settings override # defaults. # require 'config/environment' require 'nagira/nagios' class Nagira < Sinatra::Base VERSION = File.read(File.expand_path(File.dirname(__FILE__)) + '/../version.txt').strip GITHUB = "http://dmytro.github.com/nagira/" # Get all routes that Nagira provides. def api api = { } param_regex = Regexp.new '\(\[\^\\\\\/\?\#\]\+\)' Nagira.routes.keys.each do |method| api[method] ||= [] Nagira.routes[method].each do |r| path = r[0].inspect[3..-3] r[1].each do |parm| path.sub!(param_regex,":#{parm}") end path.gsub!('\\','') api[method] << path unless path.empty? end end api end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
nagira-0.2.6 | lib/nagira.rb |
nagira-0.2.5 | lib/nagira.rb |