Class: Linguist::BasicInstrumenter
- Inherits:
-
Object
- Object
- Linguist::BasicInstrumenter
- Defined in:
- lib/linguist/instrumenter.rb
Instance Attribute Summary collapse
-
#detected_info ⇒ Object
readonly
Returns the value of attribute detected_info.
Instance Method Summary collapse
-
#initialize ⇒ BasicInstrumenter
constructor
A new instance of BasicInstrumenter.
- #instrument(name, payload = {}) ⇒ Object
Constructor Details
#initialize ⇒ BasicInstrumenter
Returns a new instance of BasicInstrumenter.
5 6 7 |
# File 'lib/linguist/instrumenter.rb', line 5 def initialize @detected_info = {} end |
Instance Attribute Details
#detected_info ⇒ Object (readonly)
Returns the value of attribute detected_info.
3 4 5 |
# File 'lib/linguist/instrumenter.rb', line 3 def detected_info @detected_info end |
Instance Method Details
#instrument(name, payload = {}) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/linguist/instrumenter.rb', line 9 def instrument(name, payload = {}) if name == "linguist.detected" && payload[:blob] @detected_info[payload[:blob].name] = { strategy: payload[:strategy].name.split("::").last, language: payload[:language]&.name } end yield if block_given? end |