Class: RailsApiDoc::Controller::Response::Rabl
- Inherits:
- 
      Object
      
        - Object
- RailsApiDoc::Controller::Response::Rabl
 
- Defined in:
- lib/rails_api_doc/controller/response/rabl.rb
Overview
:nodoc:
Class Attribute Summary collapse
- 
  
    
      .renderer  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Returns the value of attribute renderer. 
Instance Attribute Summary collapse
- 
  
    
      #map  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute map. 
Instance Method Summary collapse
- #action_route(ctrl, action) ⇒ Object
- 
  
    
      #initialize(controllers)  ⇒ Rabl 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    pass all controllers registered for api doc TODO: add setting for displaying all from start. 
- #load_template(ctrl, action) ⇒ Object
Constructor Details
#initialize(controllers) ⇒ Rabl
pass all controllers registered for api doc TODO: add setting for displaying all from start
| 20 21 22 23 24 | # File 'lib/rails_api_doc/controller/response/rabl.rb', line 20 def initialize(controllers) @controllers = controllers @routes = Rails.application.routes.set.anchored_routes.reject { |r| r.defaults[:internal] } @map = construct_controller_template_map end | 
Class Attribute Details
.renderer ⇒ Object
Returns the value of attribute renderer.
| 12 13 14 | # File 'lib/rails_api_doc/controller/response/rabl.rb', line 12 def renderer @renderer end | 
Instance Attribute Details
#map ⇒ Object (readonly)
Returns the value of attribute map.
| 16 17 18 | # File 'lib/rails_api_doc/controller/response/rabl.rb', line 16 def map @map end | 
Instance Method Details
#action_route(ctrl, action) ⇒ Object
| 30 31 32 33 34 35 | # File 'lib/rails_api_doc/controller/response/rabl.rb', line 30 def action_route(ctrl, action) action_route = @map[ctrl][:routes].detect { |r| r.defaults[:action] == action } method = action_route.instance_variable_get(:@request_method_match).first.name.split('::').last route = action_route.path.spec.to_s [method, route].join(' ') end | 
#load_template(ctrl, action) ⇒ Object
| 26 27 28 | # File 'lib/rails_api_doc/controller/response/rabl.rb', line 26 def load_template(ctrl, action) RablCompiler.new("#{ctrl.controller_path}/#{action}").compile_source end |