Class: GxApi::ExperimentIdentifier
- Inherits:
- BasicObject
- Defined in:
- lib/gxapi/experiment_identifier.rb
Overview
Wrapper class to handle experiment identifier types
Instance Method Summary collapse
-
#initialize(val) ⇒ ExperimentIdentifier
constructor
Constructor.
Constructor Details
#initialize(val) ⇒ ExperimentIdentifier
Constructor
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/gxapi/experiment_identifier.rb', line 23 def initialize(val) # handle a string if val.is_a?(::String) @proxy = NameExperimentIdentifier.new(val) # handle an ID elsif val.try(:[], :id) @proxy = IdExperimentIdentifier.new(val[:id]) # error if we don't have anything valid else raise ArgumentError.new("#{val} is not a valid identifier type") end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args, &block) ⇒ Mixed (protected)
Implementation of method_missing sends to our proxy
47 48 49 |
# File 'lib/gxapi/experiment_identifier.rb', line 47 def method_missing(m, *args, &block) @proxy.send(m, *args, &block) end |