Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
34 additions
and
33 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,37 +1,38 @@ | |||
Ruby2Lolz translates Ruby code into LOLCODE (http://www.lolcode.com) | Ruby2Lolz translates Ruby code into LOLCODE (http://www.lolcode.com) | ||
|
- http://www.igvita.com/2008/12/11/ruby-ast-for-fun-and-profit/ | ||
For example: |
|
||
|
== Translating Ruby Hash & Array: | ||
class Simple | require 'ruby2lolz' | ||
def add(n1, n2) | # adds Hash.to_lolz, and Array.to_lolz | ||
return n1 + n2 |
|
||
puts {:nickname => [:ig, :igrigorik]}.to_lolz | |||
|
|||
OH HAI | |||
I CAN HAS Nickname | |||
I CAN MANY HAZ | |||
AWSUM VAR | |||
ig | |||
KTHNX. | |||
AWSUM VAR | |||
igrigorik | |||
KTHNX. | |||
KTHNXBYE. | |||
KTHNX. | |||
KTHNXBYE. | |||
|
|||
Put some Lolz into your API | |||
- http://pastie.org/327494 | |||
|
|||
== Translating a class: | |||
|
|||
class Simple | |||
def add(n1, n2) | |||
return n1 + n2 | |||
end | |||
end | end | ||
end | |||
|
|||
Ruby2Lolz.translate(Simple, :add) | |||
|
|||
HOW DUZ I HAZ add [YR n1, YR n2] | |||
(n1 + n2) | |||
IF U SAY SO | |||
|
|||
### OR ### | |||
|
|||
> Ruby2Lolz.translate({:nickname => [:ig, :igrigorik]}.inspect) | |||
|
|||
OH HAI | |||
I CAN HAS Nickname | |||
I CAN MANY HAZ | |||
AWSUM VAR | |||
ig | |||
KTHNX. | |||
AWSUM VAR | |||
igrigorik | |||
KTHNX. | |||
KTHNXBYE. | |||
KTHNX. | |||
KTHNXBYE. | |||
|
|
||
### OR ### | Ruby2Lolz.translate(Simple, :add) | ||
|
|
||
Put some Lolz into your API! | HOW DUZ I HAZ add [YR n1, YR n2] | ||
- http://pastie.org/327494 | (n1 + n2) | ||
IF U SAY SO |