A hook allow you to observe what happens to a specific object. All hooks have Hook in their mimic chain.

Mimics
Inactive cells
Active cells
Specs
Inactive cells (details)
kind = "Hook"
Active cells (details)
cellAdded(obj, sym)

nil

method(obj, sym, 
  nil)
Hook cellAdded
  • - should be called on the hook when a cell is added on the observed object [ show source ]
    xx = Origin mimic 
    yy = Hook into(xx) 
    yy invoked = 0 
    yy cellAdded = method(obj, _, @ ++(invoked)) 
    xx bar = "hello" 
    yy invoked should ==(1) 
    xx flux = method(nil) 
    yy invoked should ==(2) 
    
    
  • - should be called after the cell has been added [ show source ]
    xx = Origin mimic 
    yy = Hook into(xx) 
    yy cellAdded = fnx(obj, _, 
        xx fox should ==("blarg") 
        ) 
    xx fox = "blarg" 
    
    
  • - should give the object that has been updated [ show source ]
    xx = Origin mimic 
    yy = Hook into(xx) 
    yy cellAdded = fnx(obj, _, 
        obj should be(xx) 
        ) 
    xx fox = "blarg" 
    
    
  • - should give the name of the added cell to the hook as an argument [ show source ]
    xx = Origin mimic 
    yy = Hook into(xx) 
    yy cellAdded = fnx(obj, sym, 
        sym should ==(:fox) 
        ) 
    xx fox = "blarg" 
    
    
  • - should fire on more than one hook if available [ show source ]
    xx = Origin mimic 
    yy = Origin mimic 
    zz = Hook into(xx, yy) 
    zz invoked = 0 
    zz cellAdded = method(_, _, 
        @ ++(invoked) 
        ) 
    xx blah = "arg" 
    yy foo = "ax" 
    yy muuh = "wow" 
    zz invoked should ==(3) 
    
    
  • - should not fire when a cell is updated [ show source ]
    xx = Origin mimic 
    yy = Hook into(xx) 
    xx blarg = "hello" 
    yy invoked = 0 
    yy cellAdded = method(obj, _, @ ++(invoked)) 
    xx blarg = "goodbye" 
    yy invoked should ==(0) 
    
    
cellChanged(obj, sym, originalValue)

nil

method(obj, sym, originalValue, 
  nil)
Hook cellChanged
  • - should be called on the hook when a cell is added on the observed object [ show source ]
    xx = Origin mimic 
    yy = Hook into(xx) 
    yy invoked = 0 
    yy cellChanged = method(_, _, _, @ ++(invoked)) 
    xx bar = "hello" 
    yy invoked should ==(1) 
    xx flux = method(nil) 
    yy invoked should ==(2) 
    
    
  • - should yield nil as the previous value when adding a cell [ show source ]
    xx = Origin mimic 
    yy = Hook into(xx) 
    yy cellChanged = method(_, _, prev, prev should be nil) 
    xx bar = "hello" 
    xx flux = method(nil) 
    
    
  • - should be called on the hook when a cell is removed on the observed object [ show source ]
    xx = Origin mimic 
    xx one = 42 
    xx two = 43 
    yy = Hook into(xx) 
    yy invoked = 0 
    yy cellChanged = method(_, _, _, @ ++(invoked)) 
    xx removeCell!(:one) 
    yy invoked should ==(1) 
    xx removeCell!(:two) 
    yy invoked should ==(2) 
    
    
  • - should be called after the cell has been removed [ show source ]
    xx = Origin mimic 
    xx one = 42 
    yy = Hook into(xx) 
    yy cellChanged = fnx(_, _, _, xx cell?(:one) should be false) 
    xx removeCell!(:one) 
    
    
  • - should yield the original value of the cell when removing [ show source ]
    xx = Origin mimic 
    xx val = "foxy" 
    yy = Hook into(xx) 
    yy cellChanged = fnx(_, _, orig, orig should ==("foxy")) 
    xx removeCell!(:val) 
    
    
  • - should be called on the hook when a cell is undefined on the observed object [ show source ]
    xx = Origin mimic 
    xx one = 42 
    xx two = 43 
    yy = Hook into(xx) 
    yy invoked = 0 
    yy cellChanged = method(_, _, _, @ ++(invoked)) 
    xx undefineCell!(:one) 
    yy invoked should ==(1) 
    xx undefineCell!(:two) 
    yy invoked should ==(2) 
    
    
  • - should be called after the cell has been undefined [ show source ]
    xx = Origin mimic 
    xx one = 42 
    yy = Hook into(xx) 
    yy cellChanged = fnx(_, _, _, xx cell?(:one) should be false) 
    xx undefineCell!(:one) 
    
    
  • - should yield the original value of the cell when undefined [ show source ]
    xx = Origin mimic 
    xx val = "foxy" 
    yy = Hook into(xx) 
    yy cellChanged = fnx(_, _, orig, orig should ==("foxy")) 
    xx undefineCell!(:val) 
    
    
  • - should be called on the hook when a cell is changed on the observed object [ show source ]
    xx = Origin mimic 
    xx val = "foxy" 
    yy = Hook into(xx) 
    yy invoked = 0 
    yy cellChanged = method(_, _, _, @ ++(invoked)) 
    xx val = "blaxy" 
    yy invoked should ==(1) 
    xx val = "no way" 
    yy invoked should ==(2) 
    
    
  • - should be called after the change [ show source ]
    xx = Origin mimic 
    xx val = "foxy" 
    yy = Hook into(xx) 
    yy cellChanged = fnx(_, _, _, xx val should ==("more")) 
    xx val = "more" 
    
    
  • - should yield the object the change happened on [ show source ]
    xx = Origin mimic 
    xx val = "foxy" 
    yy = Hook into(xx) 
    yy cellChanged = fnx(obj, _, _, obj should be(xx)) 
    xx val = "more" 
    
    
  • - should yield the name of the cell [ show source ]
    xx = Origin mimic 
    xx val = "foxy" 
    yy = Hook into(xx) 
    yy cellChanged = fnx(_, sym, _, sym should ==(:val)) 
    xx val = "more" 
    
    
  • - should yield the original value of the cell [ show source ]
    xx = Origin mimic 
    xx val = "foxy" 
    yy = Hook into(xx) 
    yy cellChanged = fnx(_, _, orig, orig should ==("foxy")) 
    xx val = "more" 
    
    
  • - should fire on more than one hook if available [ show source ]
    xx = Origin mimic 
    yy = Origin mimic 
    zz = Hook into(xx, yy) 
    zz invoked = 0 
    zz cellChanged = method(_, _, _, 
        @ ++(invoked) 
        ) 
    xx blah = "arg" 
    yy foo = "ax" 
    yy muuh = "wow" 
    xx blah = "no way" 
    zz invoked should ==(4) 
    
    
cellRemoved(obj, sym, originalValue)

nil

method(obj, sym, originalValue, 
  nil)
Hook cellRemoved
  • - should be called on the hook when a cell is removed on the observed object [ show source ]
    xx = Origin mimic 
    xx val = "foo" 
    xx vax = "fox" 
    yy = Hook into(xx) 
    yy invoked = 0 
    yy cellRemoved = method(_, _, _, @ ++(invoked)) 
    xx removeCell!(:val) 
    yy invoked should ==(1) 
    xx removeCell!(:vax) 
    yy invoked should ==(2) 
    
    
  • - should be called after cellChanged [ show source ]
    xx = Origin mimic 
    xx val = "foo" 
    yy = Hook into(xx) 
    yy doneCellChanged? = false 
    yy cellChanged = method(_, _, _, @ doneCellChanged? = true) 
    yy cellRemoved = method(_, _, _, should have doneCellChanged) 
    xx removeCell!(:val) 
    
    
  • - should be called after the cell has been removed [ show source ]
    xx = Origin mimic 
    xx one = 42 
    yy = Hook into(xx) 
    yy cellRemoved = fnx(_, _, _, xx cell?(:one) should be false) 
    xx removeCell!(:one) 
    
    
  • - should yield the object the cell belonged on [ show source ]
    xx = Origin mimic 
    xx one = 42 
    yy = Hook into(xx) 
    yy cellRemoved = fnx(obj, _, _, obj should be(xx)) 
    xx removeCell!(:one) 
    
    
  • - should yield the name of the cell [ show source ]
    xx = Origin mimic 
    xx one = 42 
    yy = Hook into(xx) 
    yy cellRemoved = fnx(_, sym, _, sym should ==(:one)) 
    xx removeCell!(:one) 
    
    
  • - should yield the previous value of the cell [ show source ]
    xx = Origin mimic 
    xx one = 42 
    yy = Hook into(xx) 
    yy cellRemoved = fnx(_, _, prev, prev should ==(42)) 
    xx removeCell!(:one) 
    
    
cellUndefined(obj, sym, originalValue)

nil

method(obj, sym, originalValue, 
  nil)
Hook cellUndefined
  • - should be called on the hook when a cell is removed on the observed object [ show source ]
    xx = Origin mimic 
    xx val = "foo" 
    xx vax = "fox" 
    yy = Hook into(xx) 
    yy invoked = 0 
    yy cellUndefined = method(_, _, _, @ ++(invoked)) 
    xx undefineCell!(:val) 
    yy invoked should ==(1) 
    xx undefineCell!(:vax) 
    yy invoked should ==(2) 
    
    
  • - should be called after cellChanged [ show source ]
    xx = Origin mimic 
    xx val = "foo" 
    yy = Hook into(xx) 
    yy doneCellChanged? = false 
    yy cellChanged = method(_, _, _, @ doneCellChanged? = true) 
    yy cellUndefined = method(_, _, _, should have doneCellChanged) 
    xx undefineCell!(:val) 
    
    
  • - should be called after the cell has been undefined [ show source ]
    xx = Origin mimic 
    xx one = 42 
    yy = Hook into(xx) 
    yy cellUndefined = fnx(_, _, _, xx cell?(:one) should be false) 
    xx undefineCell!(:one) 
    
    
  • - should yield the object the cell belonged on [ show source ]
    xx = Origin mimic 
    xx one = 42 
    yy = Hook into(xx) 
    yy cellUndefined = fnx(obj, _, _, obj should be(xx)) 
    xx undefineCell!(:one) 
    
    
  • - should yield the name of the cell [ show source ]
    xx = Origin mimic 
    xx one = 42 
    yy = Hook into(xx) 
    yy cellUndefined = fnx(_, sym, _, sym should ==(:one)) 
    xx undefineCell!(:one) 
    
    
  • - should yield the previous value of the cell [ show source ]
    xx = Origin mimic 
    xx one = 42 
    yy = Hook into(xx) 
    yy cellUndefined = fnx(_, _, prev, prev should ==(42)) 
    xx undefineCell!(:one) 
    
    
connectedObjects()

returns the objects this hook is connected to

Hook connectedObjects
  • - should return the connected objects for that hook [ show source ]
    x = Origin mimic 
    y = Origin mimic 
    z = Origin mimic 
    Hook into(x) connectedObjects [](0) should be(x) 
    Hook into(x, y) connectedObjects [](0) should be(x) 
    Hook into(x, y) connectedObjects [](1) should be(y) 
    Hook into(x, y, z) connectedObjects [](0) should be(x) 
    Hook into(x, y, z) connectedObjects [](1) should be(y) 
    Hook into(x, y, z) connectedObjects [](2) should be(z) 
    Hook into(x, y, z) connectedObjects length should ==(3) 
    
    
hook!(objectToHookInto)

Takes one argument and will add that to the list of connected objects

Hook hook!
  • - should add a new observed object to the receiver [ show source ]
    xx = Origin mimic 
    yy = Hook into(xx) 
    zz = Origin mimic 
    yy hook!(zz) 
    yy connectedObjects [](1) should be(zz) 
    
    
into(firstConnected, +restConnected)

Takes one or more arguments to hook into and returns a new Hook connected to them.

Hook into
  • - should return a new hook object [ show source ]
    xx = Origin mimic 
    yy = Hook into(xx) 
    yy should mimic(Hook) 
    yy should not be(Hook) 
    
    
  • - should take one or more arguments [ show source ]
    Hook into(Origin mimic) 
    Hook into(Origin mimic, Origin mimic) 
    Hook into(Origin mimic, Origin mimic, Origin mimic) 
    Hook into(Origin mimic, Origin mimic, Origin mimic, Origin mimic) 
    Hook into(Origin mimic, Origin mimic, Origin mimic, Origin mimic, Origin mimic) 
    fn(Hook into) should signal(Condition Error Invocation TooFewArguments) 
    
    
mimicAdded(obj, newMimic)

nil

method(obj, newMimic, 
  nil)
Hook mimicAdded
  • - should call the hook when a mimic gets added [ show source ]
    xx = Origin mimic 
    yy = Hook into(xx) 
    blah = Origin mimic 
    blah2 = Origin mimic 
    yy invoked = 0 
    yy mimicAdded = method(_, _, @ ++(invoked)) 
    xx mimic!(blah) 
    yy invoked should ==(1) 
    xx mimic!(blah2) 
    yy invoked should ==(2) 
    
    
  • - should yield the object the mimic was added to [ show source ]
    xx = Origin mimic 
    yy = Hook into(xx) 
    blah = Origin mimic 
    yy mimicAdded = fnx(obj, _, obj should be(xx)) 
    xx mimic!(blah) 
    
    
  • - should yield the mimic added [ show source ]
    xx = Origin mimic 
    yy = Hook into(xx) 
    blah = Origin mimic 
    yy mimicAdded = fnx(_, m, m should be(blah)) 
    xx mimic!(blah) 
    
    
  • - should work correctly when using prependMimic! [ show source ]
    xx = Origin mimic 
    yy = Hook into(xx) 
    blah = Origin mimic 
    blah2 = Origin mimic 
    yy invoked = 0 
    yy mimicAdded = method(_, _, @ ++(invoked)) 
    xx prependMimic!(blah) 
    yy invoked should ==(1) 
    xx prependMimic!(blah2) 
    yy invoked should ==(2) 
    
    
  • - should fire after the mimic has been added [ show source ]
    xx = Origin mimic 
    yy = Hook into(xx) 
    blah = Origin mimic 
    yy mimicAdded = fnx(_, _, xx should mimic(blah)) 
    xx mimic!(blah) 
    
    
mimicRemoved(obj, removedMimic)

nil

method(obj, removedMimic, 
  nil)
Hook mimicRemoved
  • - should fire after a mimic has been removed [ show source ]
    Bex = Origin mimic 
    xx = Bex mimic 
    xx mimic!(Origin) 
    yy = Hook into(xx) 
    yy invoked = 0 
    yy mimicRemoved = method(_, _, @ ++(invoked)) 
    xx removeMimic!(Bex) 
    yy invoked should ==(1) 
    
    
  • - should fire after the mimic has been removed [ show source ]
    xx = Origin mimic 
    blah = Origin mimic 
    xx mimic!(blah) 
    yy = Hook into(xx) 
    yy mimicRemoved = fnx(_, _, xx should not mimic(blah)) 
    xx removeMimic!(blah) 
    
    
  • - should fire once for every mimic removed when you are removing more than one mimic [ show source ]
    xx = Origin mimic 
    blah = Origin mimic 
    foox = Origin mimic 
    xx mimic!(blah) 
    xx mimic!(foox) 
    yy = Hook into(xx) 
    yy invoked = 0 
    yy mimicRemoved = method(_, _, @ ++(invoked)) 
    xx removeAllMimics! 
    yy invoked should ==(3) 
    
    
  • - should yield the object the event happened on [ show source ]
    Bex = Origin mimic 
    xx = Bex mimic 
    xx mimic!(Origin) 
    yy = Hook into(xx) 
    yy mimicRemoved = fnx(obj, _, obj should be(xx)) 
    xx removeMimic!(Bex) 
    
    
  • - should yield the mimic that was removed [ show source ]
    Bex = Origin mimic 
    xx = Bex mimic 
    xx mimic!(Origin) 
    yy = Hook into(xx) 
    yy mimicRemoved = fnx(_, mm, mm should be(Bex)) 
    xx removeMimic!(Bex) 
    
    
mimicked(obj, newMimicker)

nil

method(obj, newMimicker, 
  nil)
Hook mimicked
  • - should fire when the object under observation gets mimicked [ show source ]
    xx = Origin mimic 
    yy = Hook into(xx) 
    yy invoked = 0 
    yy mimicked = method(_, _, @ ++(invoked)) 
    xx mimic 
    yy invoked should ==(1) 
    xx mimic 
    xx mimic 
    yy invoked should ==(3) 
    
    
  • - should fire when a mimic is added after the fact with mimic! [ show source ]
    xx = Origin mimic 
    zz = Origin mimic 
    yy = Hook into(xx) 
    yy invoked = 0 
    yy mimicked = method(_, _, @ ++(invoked)) 
    zz mimic!(xx) 
    yy invoked should ==(1) 
    Origin mimic mimic!(xx) 
    Origin mimic mimic!(xx) 
    yy invoked should ==(3) 
    
    
  • - should fire when a mimic is added after the fact with prependMimic! [ show source ]
    xx = Origin mimic 
    zz = Origin mimic 
    yy = Hook into(xx) 
    yy invoked = 0 
    yy mimicked = method(_, _, @ ++(invoked)) 
    zz prependMimic!(xx) 
    yy invoked should ==(1) 
    Origin mimic prependMimic!(xx) 
    Origin mimic prependMimic!(xx) 
    yy invoked should ==(3) 
    
    
  • - should fire AFTER the object has been mimicked [ show source ]
    xx = Origin mimic 
    zz = Origin mimic 
    yy = Hook into(xx) 
    yy mimicked = fnx(_, _, zz should mimic(xx)) 
    zz mimic!(xx) 
    
    
  • - should yield the object observed [ show source ]
    xx = Origin mimic 
    yy = Hook into(xx) 
    yy mimicked = fnx(obj, _, obj should be(xx)) 
    xx mimic 
    
    
  • - should yield the object that mimicked the observed object [ show source ]
    xx = Origin mimic 
    zz = Origin mimic 
    yy = Hook into(xx) 
    yy mimicked = fnx(_, mm, mm should be(zz)) 
    zz mimic!(xx) 
    
    
mimicsChanged(obj, changedMimic)

nil

method(obj, changedMimic, 
  nil)
Hook mimicsChanged
  • - should fire when a mimic is added [ show source ]
    xx = Origin mimic 
    yy = Hook into(xx) 
    blah = Origin mimic 
    blah2 = Origin mimic 
    yy invoked = 0 
    yy mimicsChanged = method(_, _, @ ++(invoked)) 
    xx mimic!(blah) 
    yy invoked should ==(1) 
    xx mimic!(blah2) 
    yy invoked should ==(2) 
    
    
  • - should fire after the mimic is added [ show source ]
    xx = Origin mimic 
    yy = Hook into(xx) 
    blah = Origin mimic 
    yy mimicsChanged = fnx(_, _, xx should mimic(blah)) 
    xx mimic!(blah) 
    
    
  • - should fire when a mimic is prepend added [ show source ]
    xx = Origin mimic 
    yy = Hook into(xx) 
    blah = Origin mimic 
    blah2 = Origin mimic 
    yy invoked = 0 
    yy mimicsChanged = method(_, _, @ ++(invoked)) 
    xx prependMimic!(blah) 
    yy invoked should ==(1) 
    xx prependMimic!(blah2) 
    yy invoked should ==(2) 
    
    
  • - should fire after the mimic is prepend added [ show source ]
    xx = Origin mimic 
    yy = Hook into(xx) 
    blah = Origin mimic 
    yy mimicsChanged = fnx(_, _, xx should mimic(blah)) 
    xx prependMimic!(blah) 
    
    
  • - should fire when a mimic is removed [ show source ]
    Bex = Origin mimic 
    xx = Bex mimic 
    xx mimic!(Origin) 
    yy = Hook into(xx) 
    yy invoked = 0 
    yy mimicsChanged = method(_, _, @ ++(invoked)) 
    xx removeMimic!(Bex) 
    yy invoked should ==(1) 
    
    
  • - should fire after the mimic is removed [ show source ]
    Bex = Origin mimic 
    xx = Bex mimic 
    xx mimic!(Origin) 
    yy = Hook into(xx) 
    yy mimicsChanged = fnx(_, _, xx should not mimic(Bex)) 
    xx removeMimic!(Bex) 
    
    
  • - should fire when a mimic is removed when all mimics are removed [ show source ]
    xx = Origin mimic 
    blah = Origin mimic 
    foox = Origin mimic 
    xx mimic!(blah) 
    xx mimic!(foox) 
    yy = Hook into(xx) 
    yy invoked = 0 
    yy mimicsChanged = method(_, _, @ ++(invoked)) 
    xx removeAllMimics! 
    yy invoked should ==(3) 
    
    
  • - should yield the object that the change was made on [ show source ]
    Bex = Origin mimic 
    xx = Bex mimic 
    xx mimic!(Origin) 
    yy = Hook into(xx) 
    yy mimicsChanged = fnx(obj, _, obj should be(xx)) 
    xx removeMimic!(Bex) 
    
    
  • - should yield the mimic that was added [ show source ]
    xx = Origin mimic 
    yy = Hook into(xx) 
    blah = Origin mimic 
    yy mimicsChanged = fnx(_, addedMimic, addedMimic should be(blah)) 
    xx mimic!(blah) 
    
    
  • - should yield the mimic that was removed [ show source ]
    Bex = Origin mimic 
    xx = Bex mimic 
    xx mimic!(Origin) 
    yy = Hook into(xx) 
    yy mimicsChanged = fnx(_, removedMimic, removedMimic should be(Bex)) 
    xx removeMimic!(Bex)