class SampleModels::Sampler::ConfigureRecipient

Public Class Methods

new(sampler) click to toggle source
# File lib/sample_models/sampler.rb, line 59
def initialize(sampler)
  @sampler = sampler
end

Public Instance Methods

before_save(&proc) click to toggle source
# File lib/sample_models/sampler.rb, line 78
def before_save(&proc)
  @sampler.before_save = proc
end
method_missing(meth, *args, &block) click to toggle source
Calls superclass method
# File lib/sample_models/sampler.rb, line 63
def method_missing(meth, *args, &block)
  if @sampler.model.column_names.include?(meth.to_s)
    Attribute.new(@sampler, meth)
  elsif @sampler.model.belongs_to_association(meth)
    Attribute.new(@sampler, meth)
  elsif @sampler.model.instance_methods.map(&:to_sym).include?(meth) && 
        @sampler.model.instance_methods.map(&:to_sym).include?("#{meth.to_s}=".to_sym)
    Attribute.new(@sampler, meth)
  elsif meth.to_s =~ /(.*)_sample$/
    @sampler.named_samples[$1] = args.first
  else
    super
  end
end