Created
October 26, 2012 21:09
-
-
Save charliemaffitt/3961533 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# File: MainView.m | |
[Doorman requestUnlockDoor:^(BOOL successfulRequest) { | |
if (successfulRequest) { | |
// do stuff | |
} | |
else { | |
// do other stuff | |
} | |
}]; | |
# File: Doorman.m | |
@implementation Doorman | |
+ (void)requestUnlockDoor:(void(^)(BOOL successfulRequest))completionHandler { | |
completionHandler(FALSE); | |
} | |
@end |
alindeman
commented
Oct 26, 2012
class Doorman
def self.open_door(&block)
block.call true #or false
end
Doorman.open_door do |success|
if success
puts "success"
else
puts "failure"
end
end
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment