Class: TypeFusion::Config
- Inherits:
-
Object
- Object
- TypeFusion::Config
- Includes:
- Singleton
- Defined in:
- lib/type_fusion/config.rb
Instance Attribute Summary collapse
-
#application_name ⇒ Object
Returns the value of attribute application_name.
-
#endpoint ⇒ Object
Returns the value of attribute endpoint.
-
#type_sample_call_rate ⇒ Object
Returns the value of attribute type_sample_call_rate.
-
#type_sample_request ⇒ Object
Returns the value of attribute type_sample_request.
-
#type_sample_tracepoint_path ⇒ Object
Returns the value of attribute type_sample_tracepoint_path.
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #type_sample_call? ⇒ Boolean
- #type_sample_request?(env) ⇒ Boolean
- #type_sample_tracepoint_path?(env) ⇒ Boolean
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
22 23 24 25 26 27 28 |
# File 'lib/type_fusion/config.rb', line 22 def initialize @type_sample_call_rate = 0.001 @type_sample_request = ->(_env) { [true, false, false, false].sample } @type_sample_tracepoint_path = ->(_tracepoint_path) { true } @endpoint = "https://gem.sh/api/v1/types/samples" @application_name = "TypeFusion" end |
Instance Attribute Details
#application_name ⇒ Object
Returns the value of attribute application_name.
20 21 22 |
# File 'lib/type_fusion/config.rb', line 20 def application_name @application_name end |
#endpoint ⇒ Object
Returns the value of attribute endpoint.
20 21 22 |
# File 'lib/type_fusion/config.rb', line 20 def endpoint @endpoint end |
#type_sample_call_rate ⇒ Object
Returns the value of attribute type_sample_call_rate.
20 21 22 |
# File 'lib/type_fusion/config.rb', line 20 def type_sample_call_rate @type_sample_call_rate end |
#type_sample_request ⇒ Object
Returns the value of attribute type_sample_request.
20 21 22 |
# File 'lib/type_fusion/config.rb', line 20 def type_sample_request @type_sample_request end |
#type_sample_tracepoint_path ⇒ Object
Returns the value of attribute type_sample_tracepoint_path.
20 21 22 |
# File 'lib/type_fusion/config.rb', line 20 def type_sample_tracepoint_path @type_sample_tracepoint_path end |
Instance Method Details
#type_sample_call? ⇒ Boolean
38 39 40 |
# File 'lib/type_fusion/config.rb', line 38 def type_sample_call? type_sample_call_rate > rand end |
#type_sample_request?(env) ⇒ Boolean
30 31 32 |
# File 'lib/type_fusion/config.rb', line 30 def type_sample_request?(env) type_sample_request&.call(env) end |
#type_sample_tracepoint_path?(env) ⇒ Boolean
34 35 36 |
# File 'lib/type_fusion/config.rb', line 34 def type_sample_tracepoint_path?(env) type_sample_tracepoint_path&.call(env) end |