Sha256: 8fd8c13183b84223bb501044e64684aa03707e00c53ee6883c44a6f2b475aa70
Contents?: true
Size: 1.58 KB
Versions: 1
Compression:
Stored size: 1.58 KB
Contents
require "traxis/version" require "active_support" require "active_support/all" module Traxis def self.bootstrap! load_concerns if concerns.any? load_responses if responses.any? register_responses end def self.controllers @controllers ||=::Dir[root.join('app', 'controllers', '**', '*_controller', '*.rb')] end def self.load_concerns concerns.each do |path| require path end end def self.concerns @concerns ||= ::Dir[root.join('app', '**', '*concerns', '*.rb')] end def self.eager_require_directory(*args) ::Dir[::Traxis.root.join(*args)].each do |path| require path end end def self.load_responses responses.each do |path| require path end end # Because praxis is using inherited hook,responses arent registered # i.e. response.response_name is nil, as rest of class # (where assignment is made) hasn't been loaded yet def self.register_response(klass) ::Praxis::ApiDefinition.define do |api| api.response_template klass.response_name do status klass.status end end if !klass.subclasses.empty? klass.subclasses.each do |subklass| ::Traxis.register_response(subklass) end end end def self.register_responses ::Traxis::Responses::Base.subclasses.each do |klass| ::Traxis.register_response(klass) end end def self.responses @responses ||=::Dir[root.join('app', '**', '*concerns', '*.rb')] end def self.root ::Praxis::Application.instance.root end end require "traxis/response" ::Traxis.bootstrap! require "traxis/controller"
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
traxis-0.0.1 | lib/traxis.rb |