<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: virtual code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Mon, 06 Oct 2008 10:20:29 GMT</pubDate>
    <description>DZone Snippets: virtual code</description>
    <item>
      <title>Use rsync to mirror directories between Virtual Hosts.</title>
      <link>http://snippets.dzone.com/posts/show/5561</link>
      <description>The following shell command will rsync the mysite.com directory 'feed' to mysite2.com&lt;br /&gt;&lt;code&gt;&lt;br /&gt;rsync -a /var/www/mysite.com/feed /var/www/mysite2.com&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Thu, 29 May 2008 23:16:58 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5561</guid>
      <author>jrobertson (James Robertson)</author>
    </item>
    <item>
      <title>Adding virtual methods to Ruby</title>
      <link>http://snippets.dzone.com/posts/show/2621</link>
      <description>From: &lt;br /&gt;http://ozone.wordpress.com/2006/02/28/adding-virtual-methods-to-ruby/&lt;br /&gt;&lt;br /&gt;Author: Olivier Ansaldi&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;br /&gt;class VirtualMethodCalledError &lt; RuntimeError&lt;br /&gt;  attr :name&lt;br /&gt;  def initialize(name)&lt;br /&gt;    super("Virtual function '#{name}' called")&lt;br /&gt;    @name = name&lt;br /&gt;  end&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;class Module&lt;br /&gt;  def virtual(*methods)&lt;br /&gt;    methods.each do |m|&lt;br /&gt;      define_method(m) {&lt;br /&gt;        raise VirtualMethodCalledError, m&lt;br /&gt;      }&lt;br /&gt;    end&lt;br /&gt;  end&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;# The usage is beautifully simple:&lt;br /&gt;&lt;br /&gt;class VirtualThingy&lt;br /&gt;  virtual :doThingy&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;class ConcreteThingy &lt; VirtualThingy&lt;br /&gt;  def doThingy&lt;br /&gt;    puts "Doin' my thing!"&lt;br /&gt;  end&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;begin&lt;br /&gt;  VirtualThingy.new.doThingy&lt;br /&gt;rescue VirtualMethodCalledError =&gt; e&lt;br /&gt;  raise unless e.name == :doThingy&lt;br /&gt;end&lt;br /&gt;ConcreteThingy.new.doThingy&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Mon, 18 Sep 2006 20:38:48 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/2621</guid>
      <author>ntk ()</author>
    </item>
  </channel>
</rss>
