module Flipper::UI
Constants
- Error
-
All flipper ui errors inherit from this.
- RequestMethodNotSupported
-
Raised when a request method (get, post, etc.) is called for an action that does not know how to handle it.
Public Class Methods
Source
# File lib/flipper/ui.rb, line 21 def self.app(flipper = nil, options = {}) env_key = options.fetch(:env_key, 'flipper') rack_protection_options = if options.key?(:rack_protection) options[:rack_protection] else {} end app = ->(_) { [200, { Rack::CONTENT_TYPE => 'text/html' }, ['']] } builder = Rack::Builder.new yield builder if block_given? # Only use Rack::Protection::AuthenticityToken if no other options are # provided. Should avoid some pain for some people. If any options are # provided then go whole hog and include all of Rack::Protection for # backwards compatibility. if rack_protection_options.empty? builder.use Rack::Protection::AuthenticityToken else builder.use Rack::Protection, rack_protection_options end builder.use Rack::MethodOverride builder.use Flipper::Middleware::SetupEnv, flipper, env_key: env_key builder.use Flipper::UI::Middleware, flipper: flipper, env_key: env_key builder.run app klass = self app = builder.to_app app.define_singleton_method(:inspect) { klass.inspect } # pretty rake routes output app end
Source
# File lib/flipper/ui.rb, line 58 def self.configuration @configuration ||= ::Flipper::UI::Configuration.new end
Source
# File lib/flipper/ui.rb, line 54 def self.configure yield(configuration) end
Public: yields configuration instance for customizing UI
text
Source
# File lib/flipper/ui.rb, line 17 def self.root @root ||= Pathname(__FILE__).dirname.expand_path.join('ui') end