Block - HotRuby - Ruby on JavaScript & Flash

HotRuby

Ruby on JavaScript and Flash

HotRuby > TEST > Block

Update 2008-07-24 | Create 2008-07-23

Result


Source

class Hoge
  def add_msg &block
    block.yield "is"
  end
end
  
class Foo
  NAME = ' - William Shakespeare'
  def main
    pre = "Action"
    @space = " "
    Hoge.new.add_msg do |msg|
      fuga = "eloquence"
      puts pre + @space + msg + @space + fuga + NAME
    end
  end
end
  
Foo.new.main