Class: ContextData

Inherits:
Object
  • Object
show all
Defined in:
lib/json/context_data.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(experiments = []) ⇒ ContextData

Returns a new instance of ContextData.



8
9
10
11
12
13
# File 'lib/json/context_data.rb', line 8

def initialize(experiments = [])
  @experiments = experiments.map do |experiment|
    Experiment.new(experiment)
  end unless experiments.nil?
  self
end

Instance Attribute Details

#experimentsObject

Returns the value of attribute experiments.



6
7
8
# File 'lib/json/context_data.rb', line 6

def experiments
  @experiments
end

Instance Method Details

#==(o) ⇒ Object



15
16
17
18
19
20
# File 'lib/json/context_data.rb', line 15

def ==(o)
  return true if self.object_id == o.object_id
  return false if o.nil? || self.class != o.class

  @experiments == o.experiments
end

#hash_codeObject



22
23
24
# File 'lib/json/context_data.rb', line 22

def hash_code
  { name: @name, config: @config }
end

#to_sObject



26
27
28
29
30
# File 'lib/json/context_data.rb', line 26

def to_s
  "ContextData{" +
    "experiments='" + @experiments.join +
    "}"
end