Class: Radar::App::AnalyzerController
- Inherits:
-
Object
- Object
- Radar::App::AnalyzerController
- Includes:
- Controller
- Defined in:
- lib/radar/app/analyzer_controller.rb
Instance Attribute Summary
Attributes included from Controller
Class Method Summary collapse
Instance Method Summary collapse
- #analyzers ⇒ Object
- #create_session(session_id, analyzer_id) ⇒ Object
- #example_result(session_id) ⇒ Object
-
#initialize ⇒ AnalyzerController
constructor
A new instance of AnalyzerController.
Methods included from Controller
Methods included from Logger
Constructor Details
#initialize ⇒ AnalyzerController
Returns a new instance of AnalyzerController.
9 10 11 |
# File 'lib/radar/app/analyzer_controller.rb', line 9 def initialize @sessions = {} end |
Class Method Details
.<<(analyzer_class) ⇒ Object
17 18 19 |
# File 'lib/radar/app/analyzer_controller.rb', line 17 def self.<<(analyzer_class) registry[analyzer_class.new.config.id] = analyzer_class.name end |
Instance Method Details
#analyzers ⇒ Object
13 14 15 |
# File 'lib/radar/app/analyzer_controller.rb', line 13 def analyzers registry.values.map { |analyzer_class| Object.const_get(analyzer_class).new.config } end |
#create_session(session_id, analyzer_id) ⇒ Object
21 22 23 24 25 |
# File 'lib/radar/app/analyzer_controller.rb', line 21 def create_session(session_id, analyzer_id) analyzer = create_fresh_analyzer(analyzer_id) @sessions[session_id] = Session.new(analyzer) analyzer.config end |
#example_result(session_id) ⇒ Object
27 28 29 30 31 |
# File 'lib/radar/app/analyzer_controller.rb', line 27 def example_result(session_id) synchronized(session_id) do @sessions[session_id].analyzer.example_result end end |