class PlanOut::Assignment

Attributes

data[RW]
experiment_salt[RW]

Public Class Methods

new(experiment_salt) click to toggle source
# File lib/plan_out/assignment.rb, line 5
def initialize(experiment_salt)
  @experiment_salt = experiment_salt
  @data = {}
end

Public Instance Methods

[](x) click to toggle source
# File lib/plan_out/assignment.rb, line 29
def [](x)
  get(x)
end
[]=(x,y) click to toggle source
# File lib/plan_out/assignment.rb, line 33
def []=(x,y)
  set(x,y)
end
evaluate(data) click to toggle source
# File lib/plan_out/assignment.rb, line 10
def evaluate(data)
  data
end
get(var, default = nil) click to toggle source
# File lib/plan_out/assignment.rb, line 14
def get(var, default = nil)
  @data[var.to_sym] || default
end
get_params() click to toggle source
# File lib/plan_out/assignment.rb, line 37
def get_params
  @data
end
set(name, value) click to toggle source

in python this would be defined as __setattr__ or __setitem__ not sure how to do this in Ruby.

# File lib/plan_out/assignment.rb, line 20
def set(name, value)
  if value.is_a? Operator
    value.args[:salt] = name if !value.args.has_key?(:salt)
    @data[name.to_sym] = value.execute(self)
  else
    @data[name.to_sym] = value
  end
end