Module: Kapellmeister::Base
- Defined in:
- lib/kapellmeister/base.rb
Class Method Summary collapse
Instance Method Summary collapse
- #configuration ⇒ Object
- #configure {|configuration| ... } ⇒ Object
- #logger ⇒ Object
- #report(data) ⇒ Object
- #requests ⇒ Object
- #responder ⇒ Object
Class Method Details
.routes_scheme_parse(path) ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/kapellmeister/base.rb', line 28 def self.routes_scheme_parse(path) template = ERB.new(File.read(path)).result YAML.safe_load(template, aliases: true, permitted_classes: [Symbol, Date, Time]).deep_symbolize_keys rescue Errno::ENOENT warn 'No such file or directory', path {} end |
Instance Method Details
#configuration ⇒ Object
2 3 4 |
# File 'lib/kapellmeister/base.rb', line 2 def configuration @configuration ||= self::Configuration.new end |
#configure {|configuration| ... } ⇒ Object
10 11 12 |
# File 'lib/kapellmeister/base.rb', line 10 def configure yield(configuration) end |
#logger ⇒ Object
14 15 16 |
# File 'lib/kapellmeister/base.rb', line 14 def logger @logger ||= configuration.logger end |
#report(data) ⇒ Object
6 7 8 |
# File 'lib/kapellmeister/base.rb', line 6 def report(data) responder.new(data) end |
#requests ⇒ Object
18 19 20 21 22 |
# File 'lib/kapellmeister/base.rb', line 18 def requests @requests ||= generate_routes(self::ROUTES).transform_values! do |value| value.except!(:use_wrapper) end end |
#responder ⇒ Object
24 25 26 |
# File 'lib/kapellmeister/base.rb', line 24 def responder @responder ||= defined?(self::Responder) ? self::Responder : Kapellmeister::Responder end |