Class: Modesty::Experiment::ArgumentProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/modesty/experiment/stats.rb

Instance Method Summary collapse

Constructor Details

#initialize(obj, *args) ⇒ ArgumentProxy

Returns a new instance of ArgumentProxy.



49
50
51
52
# File 'lib/modesty/experiment/stats.rb', line 49

def initialize(obj, *args)
  @obj = obj
  @args = args
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args) ⇒ Object



58
59
60
61
62
63
64
65
66
# File 'lib/modesty/experiment/stats.rb', line 58

def method_missing(meth, *args)
  data = @obj.send(meth, *(args + @args))
  # [Jay] #TODO: Hack alert!
  # this doesn't take into account Metric#all,
  # which returns an Array for either a date range
  # or a single day
  data = data.sum if data.is_a?(Array)
  data
end

Instance Method Details

#inspectObject



54
55
56
# File 'lib/modesty/experiment/stats.rb', line 54

def inspect
  "#<ArgumentProxy[ #{@obj.inspect} ]>"
end