Class: Angband::Documentation
- Inherits:
-
Object
- Object
- Angband::Documentation
- Defined in:
- lib/angband/documentation.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
- #configure(files) ⇒ Object
-
#initialize(app) {|_self| ... } ⇒ Documentation
constructor
A new instance of Documentation.
Constructor Details
#initialize(app) {|_self| ... } ⇒ Documentation
Returns a new instance of Documentation.
7 8 9 10 |
# File 'lib/angband/documentation.rb', line 7 def initialize(app) @app = app yield self if block_given? end |
Instance Method Details
#call(env) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/angband/documentation.rb', line 12 def call(env) response = Rack::AcceptHeaders.new(@app).call(env) if (env) && successful?(response) && !cross_origin_request?(env) features = Angband::GherkinFinder.new(@files).call(env['PATH_INFO']) formatter = Angband::Formatter.new(env['rack-accept_headers.request']) headers, content = formatter.call(features) response[1].merge!(headers) response[2] = [content] end response end |
#configure(files) ⇒ Object
27 28 29 |
# File 'lib/angband/documentation.rb', line 27 def configure(files) @files = files end |