module Isurvey::Collector

Public Instance Methods

[](ind) click to toggle source
# File lib/isurvey/collector.rb, line 21
def [](ind)
  all[ind]
end
all() click to toggle source
# File lib/isurvey/collector.rb, line 13
def all
  ObjectSpace.each_object(self).entries 
end
first() click to toggle source
# File lib/isurvey/collector.rb, line 17
def first
  all.first
end
method_missing(method, *args, &block) click to toggle source
Calls superclass method
# File lib/isurvey/collector.rb, line 4
def method_missing(method, *args, &block)
  if method.to_s =~ /^find_by_(.+)$/
    to_find = method.to_s.sub(/find_by_/, '')
    all.select { |obj| obj.send(to_find.to_sym) == args.first } 
  else
    super
  end
end