Por que é relevante saber um pouco sobre jRuby? Alguns exemplos práticos do uso de jRuby no dia-a-dia de um programador Java, porque usar jRuby pode ser divertido e ainda lucrativo.
mov bx, offset message ; store address of message in bx begin: cmp byte ptr [bx], 0 ; is this end of string? je fin ; if yes goto Finished inc cx ; cx = cx + 1 inc bx ; bx points to next character jmp begin Saturday, November 24, 12
mov bx, offset message ; store address of message in bx begin: cmp byte ptr [bx], 0 ; is this end of string? je fin ; if yes goto Finished inc cx ; cx = cx + 1 inc bx ; bx points to next character jmp begin int stringlength = string.length(); Java Saturday, November 24, 12
< JFrame def initialize super "Example" setSize(150, 100) setDefaultCloseOperation(JFrame::EXIT_ON_CLOSE) setLocationRelativeTo(nil) button = JButton.new("Say Hello") add(button) button.addActionListener do |e| JOptionPane.showMessageDialog(nil, "Hello World") end setVisible(true) end end Saturday, November 24, 12
fib(n-2) end start = Time.now 1.upto(10).map do |n| " Thread.new do " " puts "Thread #{n}: #{fib(32)}" " end end puts "Time: #{Time.now - start}" Saturday, November 24, 12
" def sum(a, b) puts a + b end end static { __ruby__.getLoadService().lockAndRequire("my_math"); ... } public void sum(int a, int b) { ... } Saturday, November 24, 12
self.main(args) sum(args[0], args[1]) end java_signature 'void sum(int, int)' def self.sum(a, b) puts a.to_i + b.to_i end end Saturday, November 24, 12