class CallbacksTest::MySlate

Attributes

history[R]
save_fails[RW]

Public Class Methods

new() click to toggle source
# File activesupport/test/callbacks_test.rb, line 230
def initialize
  @history = []
end

Public Instance Methods

method_missing(sym, *) { || ... } click to toggle source
Calls superclass method
# File activesupport/test/callbacks_test.rb, line 244
def method_missing(sym, *)
  case sym
  when /^log_(.*)/
    @history << $1
    nil
  when /^wrap_(.*)/
    @history << "wrap_#$1"
    yield
    @history << "unwrap_#$1"
    nil
  when /^double_(.*)/
    @history << "first_#$1"
    yield
    @history << "second_#$1"
    yield
    @history << "third_#$1"
  else
    super
  end
end
no() click to toggle source
# File activesupport/test/callbacks_test.rb, line 241
def no; false; end
respond_to_missing?(sym) click to toggle source
Calls superclass method
# File activesupport/test/callbacks_test.rb, line 265
def respond_to_missing?(sym)
  sym =~ /^(log|wrap)_/ || super
end
save() click to toggle source
# File activesupport/test/callbacks_test.rb, line 234
def save
  run_callbacks :save do
    raise "inside save" if save_fails
    @history << "running"
  end
end
yes() click to toggle source
# File activesupport/test/callbacks_test.rb, line 242
def yes; true; end