Module: Skylight::Core::Normalizers Private
- Defined in:
- lib/skylight/core/normalizers.rb,
lib/skylight/core/normalizers/sql.rb,
lib/skylight/core/normalizers/render.rb,
lib/skylight/core/normalizers/default.rb,
lib/skylight/core/normalizers/sequel/sql.rb,
lib/skylight/core/normalizers/moped/query.rb,
lib/skylight/core/normalizers/grape/endpoint.rb,
lib/skylight/core/normalizers/data_mapper/sql.rb,
lib/skylight/core/normalizers/faraday/request.rb,
lib/skylight/core/normalizers/active_record/sql.rb,
lib/skylight/core/normalizers/active_job/perform.rb,
lib/skylight/core/normalizers/grape/endpoint_run.rb,
lib/skylight/core/normalizers/active_support/cache.rb,
lib/skylight/core/normalizers/coach/handler_finish.rb,
lib/skylight/core/normalizers/elasticsearch/request.rb,
lib/skylight/core/normalizers/grape/endpoint_render.rb,
lib/skylight/core/normalizers/grape/format_response.rb,
lib/skylight/core/normalizers/coach/middleware_finish.rb,
lib/skylight/core/normalizers/active_support/cache_read.rb,
lib/skylight/core/normalizers/action_view/render_partial.rb,
lib/skylight/core/normalizers/active_support/cache_clear.rb,
lib/skylight/core/normalizers/active_support/cache_exist.rb,
lib/skylight/core/normalizers/active_support/cache_write.rb,
lib/skylight/core/normalizers/grape/endpoint_run_filters.rb,
lib/skylight/core/normalizers/action_controller/send_file.rb,
lib/skylight/core/normalizers/action_view/render_template.rb,
lib/skylight/core/normalizers/active_record/instantiation.rb,
lib/skylight/core/normalizers/active_support/cache_delete.rb,
lib/skylight/core/normalizers/action_view/render_collection.rb,
lib/skylight/core/normalizers/active_support/cache_generate.rb,
lib/skylight/core/normalizers/active_support/cache_decrement.rb,
lib/skylight/core/normalizers/active_support/cache_fetch_hit.rb,
lib/skylight/core/normalizers/active_support/cache_increment.rb,
lib/skylight/core/normalizers/active_model_serializers/render.rb,
lib/skylight/core/normalizers/active_support/cache_read_multi.rb,
lib/skylight/core/normalizers/action_controller/process_action.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Convert AS::N events to Skylight events
Defined Under Namespace
Modules: ActionController, ActionView, ActiveJob, ActiveModelSerializers, ActiveRecord, ActiveSupport, Coach, DataMapper, Elasticsearch, Faraday, Grape, Moped, Sequel Classes: Container, Default, Normalizer, RenderNormalizer, SQL
Constant Summary collapse
- DEFAULT =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Default.new
Class Method Summary collapse
- .build(config) ⇒ Object private
- .disable(*names) ⇒ Object private
- .enable(*names, enabled: true) ⇒ Object private
- .register(name, klass, opts = {}) ⇒ Object private
- .registry ⇒ Object private
- .unregister(name) ⇒ Object private
Class Method Details
.build(config) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/skylight/core/normalizers.rb', line 35 def self.build(config) normalizers = {} registry.each do |key, (klass, enabled)| next if !enabled unless klass.method_defined?(:normalize) # TODO: Warn next end normalizers[key] = klass.new(config) end Container.new(normalizers) end |
.disable(*names) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
31 32 33 |
# File 'lib/skylight/core/normalizers.rb', line 31 def self.disable(*names) enable(*names, enabled: false) end |
.enable(*names, enabled: true) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
23 24 25 26 27 28 29 |
# File 'lib/skylight/core/normalizers.rb', line 23 def self.enable(*names, enabled: true) names.each do |name| matches = registry.select{|n,_| n =~ /(^|\.)#{name}$/ } raise ArgumentError, "no normalizers match #{name}" if matches.empty? matches.values.each{|v| v[1] = enabled } end end |
.register(name, klass, opts = {}) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
14 15 16 17 |
# File 'lib/skylight/core/normalizers.rb', line 14 def self.register(name, klass, opts={}) enabled = opts[:enabled] != false registry[name] = [klass, enabled] end |
.registry ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
10 11 12 |
# File 'lib/skylight/core/normalizers.rb', line 10 def self.registry @registry ||= {} end |
.unregister(name) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
19 20 21 |
# File 'lib/skylight/core/normalizers.rb', line 19 def self.unregister(name) @registry.delete(name) end |