Class: Unleash::Variant
- Inherits:
 - 
      Object
      
        
- Object
 - Unleash::Variant
 
 
- Defined in:
 - lib/unleash/variant.rb
 
Instance Attribute Summary collapse
- 
  
    
      #enabled  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
Returns the value of attribute enabled.
 - 
  
    
      #name  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
Returns the value of attribute name.
 - 
  
    
      #payload  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
Returns the value of attribute payload.
 
Instance Method Summary collapse
- #==(other) ⇒ Object
 - 
  
    
      #initialize(params = {})  ⇒ Variant 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of Variant.
 - #to_s ⇒ Object
 
Constructor Details
#initialize(params = {}) ⇒ Variant
Returns a new instance of Variant.
      5 6 7 8 9 10 11 12 13  | 
    
      # File 'lib/unleash/variant.rb', line 5 def initialize(params = {}) raise ArgumentError, "Variant initializer requires a hash." unless params.is_a?(Hash) self.name = params.values_at('name', :name).compact.first self.enabled = params.values_at('enabled', :enabled).compact.first || false self.payload = params.values_at('payload', :payload).compact.first raise ArgumentError, "Variant requires a name." if self.name.nil? end  | 
  
Instance Attribute Details
#enabled ⇒ Object
Returns the value of attribute enabled.
      3 4 5  | 
    
      # File 'lib/unleash/variant.rb', line 3 def enabled @enabled end  | 
  
#name ⇒ Object
Returns the value of attribute name.
      3 4 5  | 
    
      # File 'lib/unleash/variant.rb', line 3 def name @name end  | 
  
#payload ⇒ Object
Returns the value of attribute payload.
      3 4 5  | 
    
      # File 'lib/unleash/variant.rb', line 3 def payload @payload end  | 
  
Instance Method Details
#==(other) ⇒ Object
      19 20 21  | 
    
      # File 'lib/unleash/variant.rb', line 19 def ==(other) self.name == other.name && self.enabled == other.enabled && self.payload == other.payload end  | 
  
#to_s ⇒ Object
      15 16 17  | 
    
      # File 'lib/unleash/variant.rb', line 15 def to_s "<Variant: name=#{self.name},enabled=#{self.enabled},payload=#{self.payload}>" end  |