Class: Rack::Usermanual
- Inherits:
-
Sinatra::Base
- Object
- Sinatra::Base
- Rack::Usermanual
- Defined in:
- lib/rack/usermanual/app.rb
Constant Summary collapse
- VERSION =
"0.1.0"
Instance Method Summary collapse
- #get_feature(path, page) ⇒ Object
-
#initialize(app, options) ⇒ Usermanual
constructor
A new instance of Usermanual.
Constructor Details
#initialize(app, options) ⇒ Usermanual
Returns a new instance of Usermanual.
12 13 14 15 16 17 |
# File 'lib/rack/usermanual/app.rb', line 12 def initialize(app, ) super(app) @sections = [:sections] @index = [:index] @main_views = [:views] end |
Instance Method Details
#get_feature(path, page) ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/rack/usermanual/app.rb', line 52 def get_feature(path, page) sio = StringIO.new json_formatter = Gherkin::Formatter::JSONFormatter.new(sio) parser = Gherkin::Parser::Parser.new(json_formatter) filepath = "#{path}/#{page}.feature" halt 404 unless ::File.exist?(filepath) raw = ::File.read(filepath) parser.parse(raw, uri, 0) json_formatter.done [raw, JSON.parse(sio.string)] end |