Skip to content

Commit

Permalink
allow multiple argument blocks to be returned from Symbol#to_block
Browse files Browse the repository at this point in the history
  • Loading branch information
bakkdoor committed Sep 28, 2012
1 parent 7dca476 commit bec9aa0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/symbol.fy
Expand Up @@ -63,14 +63,16 @@ class Symbol {

def to_block {
"""
@return @Block@ that sends @self as a message to its argument.
@return @Block@ that sends @self to its first argument, passing along any remaining arguments.
Example:
'inspect to_block
# is equal to:
@{ inspect }
"""

@{ receive_message: self }
|args| {
call: args
}
}
}
6 changes: 6 additions & 0 deletions tests/symbol.fy
Expand Up @@ -40,5 +40,11 @@ FancySpec describe: Symbol with: {

str = "hello, world yo!\"foo\""
b call: [str] . is: $ @{ inspect } call: [str]

add = '+ to_block
{ add call: [2] } raises: ArgumentError
add call: [0,1] . is: 1
add call: [2,3] . is: 5
{ add call: [2,3,4] } raises: ArgumentError
}
}

0 comments on commit bec9aa0

Please sign in to comment.