Class: FeatureHub::Sdk::InterceptorValue
- Inherits:
-
Object
- Object
- FeatureHub::Sdk::InterceptorValue
- Defined in:
- lib/feature_hub/sdk/interceptors.rb
Overview
represents an intercepted value
Instance Method Summary collapse
- #cast(expected_type) ⇒ Object
-
#initialize(val) ⇒ InterceptorValue
constructor
A new instance of InterceptorValue.
Constructor Details
#initialize(val) ⇒ InterceptorValue
Returns a new instance of InterceptorValue.
7 8 9 |
# File 'lib/feature_hub/sdk/interceptors.rb', line 7 def initialize(val) @val = val end |
Instance Method Details
#cast(expected_type) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/feature_hub/sdk/interceptors.rb', line 11 def cast(expected_type) return @val if expected_type.nil? || @val.nil? case expected_type when "BOOLEAN" @val.to_s.downcase.strip == "true" when "NUMBER" @val.to_s.to_f else @val.to_s end end |