<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Seven steps &#187; ruby</title>
	<atom:link href="http://trevoke.net/blog/tag/ruby/feed/" rel="self" type="application/rss+xml" />
	<link>http://trevoke.net/blog</link>
	<description>Martial arts and technology, $DEITY what a mix!</description>
	<lastBuildDate>Wed, 01 Feb 2012 03:43:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Ruby: What is at_exit and how to write tests for it.</title>
		<link>http://trevoke.net/blog/2012/01/06/ruby-what-is-at_exit-and-how-to-write-tests-for-it/</link>
		<comments>http://trevoke.net/blog/2012/01/06/ruby-what-is-at_exit-and-how-to-write-tests-for-it/#comments</comments>
		<pubDate>Fri, 06 Jan 2012 16:35:03 +0000</pubDate>
		<dc:creator>Trevoke</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[at_exit]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://trevoke.net/blog/?p=319</guid>
		<description><![CDATA[Ruby has a neat feature called at_exit which takes a block and then executes the contents of this block when the program ends. There are a couple of VERY important details: It takes a block and converts it into a Proc object at the time of parsing. This means that the data has to be <a href='http://trevoke.net/blog/2012/01/06/ruby-what-is-at_exit-and-how-to-write-tests-for-it/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Ruby has a neat feature called at_exit which takes a block and then executes the contents of this block when the program ends. There are a couple of VERY important details:</p>
<ol>
<li>It takes a block and converts it into a Proc object at the time of parsing. This means that the data has to be available in the binding, or you&#8217;ll run into errors. Example: instance variables need to be set before you can use them in that block. Better idea: don&#8217;t use instance variables in there at all.</li>
<li>You can &#8216;chain&#8217; at_exit calls, and they will be resolved in a First In, Last Out (FILO) order.</li>
</ol>
<p>Once you know this, using at_exit and writing tests for it becomes a little easier:</p>
<pre class="brush: ruby; title: ; notranslate">class Piddler
   def initialize
     create_pid_file
   end

   private

   def create_pid_file
     pid_file = &quot;/tmp/piddler/my_pid&quot; #Simplified for example purposes
     File.new(pid_file, 'w')
     at_exit { FileUtils.rm_f pid_file }
   end
end</pre>
<p>What you&#8217;ll notice is that the at_exit block is defined RIGHT AFTER I create what I will need to resolve/undo/finish &#8211; not separately, right inside the method.</p>
<p>&nbsp;</p>
<pre class="brush: ruby; title: ; notranslate">def test_clears_pid_file_when_it_exits
   at_exit { assert_equal 0, Dir['/tmp/piddler/*].size}
   Piddler.new
end
</pre>
<p>The advantage of that is that I know exactly when it gets defined. For this example, it gets defined at the end of the &#8216;initialize &gt; create_pid_file&#8217; call. This means that any at_exit blocks defined BEFORE that will be resolved AFTER.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://trevoke.net/blog/2012/01/06/ruby-what-is-at_exit-and-how-to-write-tests-for-it/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ruby callbacks (hooks)</title>
		<link>http://trevoke.net/blog/2010/03/31/ruby-callbacks-hooks/</link>
		<comments>http://trevoke.net/blog/2010/03/31/ruby-callbacks-hooks/#comments</comments>
		<pubDate>Wed, 31 Mar 2010 17:28:13 +0000</pubDate>
		<dc:creator>Trevoke</dc:creator>
				<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://trevoke.net/blog/?p=177</guid>
		<description><![CDATA[Hooks are a fascinating bit of Ruby magic. They are methods you can define with actions to run when something happens. You can put triggers in your code. This blog post explains them very well; and for more information, get &#8220;Metaprogramming Ruby&#8221;, which is a great book &#8211; not only about the callbacks, but about <a href='http://trevoke.net/blog/2010/03/31/ruby-callbacks-hooks/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Hooks are a fascinating bit of Ruby magic. They are methods you can define with actions to run when something happens. You can put triggers in your code.</p>
<p>
<a  href="http://www.khelll.com/blog/ruby/ruby-callbacks/" onclick="javascript:pageTracker._trackPageview('/external/www.khelll.com/blog/ruby/ruby-callbacks/');" >This blog post</a> explains them very well; and for more information, get &#8220;Metaprogramming Ruby&#8221;, which is a great book &#8211; not only about the callbacks, but about a host of information.</p>
]]></content:encoded>
			<wfw:commentRss>http://trevoke.net/blog/2010/03/31/ruby-callbacks-hooks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New gem: ListBrowser</title>
		<link>http://trevoke.net/blog/2010/01/15/new-gem-listbrowser/</link>
		<comments>http://trevoke.net/blog/2010/01/15/new-gem-listbrowser/#comments</comments>
		<pubDate>Sat, 16 Jan 2010 00:01:19 +0000</pubDate>
		<dc:creator>Trevoke</dc:creator>
				<category><![CDATA[ruby]]></category>
		<category><![CDATA[gem]]></category>
		<category><![CDATA[listbrowser]]></category>

		<guid isPermaLink="false">http://trevoke.net/blog/?p=209</guid>
		<description><![CDATA[~~~~ ListBrowser README ~~~~ I was working on a parser for a very specific tree structure, and was frustrated that there wasn’t a simple way to parse it in irb. &#8220;What??&#8221;, I thought. &#8220;I have to use my brain?! God forbid!&#8221;. So I set to using my brain a little more to create this tool. <a href='http://trevoke.net/blog/2010/01/15/new-gem-listbrowser/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>~~~~ ListBrowser README ~~~~</p>
<p>I was working on a parser for a very specific tree structure, and was frustrated that there wasn’t a simple way to parse it in irb. &#8220;What??&#8221;, I thought. &#8220;I have to use my brain?! God forbid!&#8221;. So I set to using my brain a little more to create this tool. It’s not much, but maybe it’ll make someone’s life a little easier.</p>
<p>Install: (set up gemcutter)<br />
gem install ListBrowser</p>
<p>It can be used in irb, and really should be used there &#8211; when you call it on a tree structure, you’ll get a menu with a list of choices on how you want to go through whatever structure you gave it.</p>
<p>In my particular, special case, I would do something like this:</p>
<p>require ‘sgf_parser’ # For my tree structure require ‘list_browser’ # For this.</p>
<p>tree = SgfParser::Tree.new :filename => &#8220;kogo.sgf&#8221;</p>
<p>ListBrowser.new tree.root, ‘parent’, ‘children’, ‘properties’</p>
<p># And follow the menu!</p>
<p> In my particular case, I would not need to enter those strings, as they<br />
 just happen to be the names I chose for my tree structure, but they should<br />
 serve as a good enough example!</p>
]]></content:encoded>
			<wfw:commentRss>http://trevoke.net/blog/2010/01/15/new-gem-listbrowser/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ruby SgfParser now really working!</title>
		<link>http://trevoke.net/blog/2009/12/31/ruby-sgfparser-now-really-working/</link>
		<comments>http://trevoke.net/blog/2009/12/31/ruby-sgfparser-now-really-working/#comments</comments>
		<pubDate>Thu, 31 Dec 2009 18:18:51 +0000</pubDate>
		<dc:creator>Trevoke</dc:creator>
				<category><![CDATA[ruby]]></category>
		<category><![CDATA[weiqi]]></category>
		<category><![CDATA[baduk]]></category>
		<category><![CDATA[go]]></category>
		<category><![CDATA[sgf]]></category>

		<guid isPermaLink="false">http://trevoke.net/blog/?p=207</guid>
		<description><![CDATA[Thanks @alfmikula, it saves properly and has even been gemified. I will soon push it to gemcutter and maybe put a homesite on Rubyforge, not sure. It can be found at http://github.com/Trevoke/SGFParser for now, get the code while it&#8217;s hot!]]></description>
			<content:encoded><![CDATA[<p>Thanks @alfmikula, it saves properly and has even been gemified. I will soon push it to gemcutter and maybe put a homesite on Rubyforge, not sure.<br />
It can be found at http://github.com/Trevoke/SGFParser for now, get the code while it&#8217;s hot! <img src='http://trevoke.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://trevoke.net/blog/2009/12/31/ruby-sgfparser-now-really-working/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Random constrained permutations in Ruby</title>
		<link>http://trevoke.net/blog/2009/12/17/random-constrained-permutations-in-ruby/</link>
		<comments>http://trevoke.net/blog/2009/12/17/random-constrained-permutations-in-ruby/#comments</comments>
		<pubDate>Thu, 17 Dec 2009 18:50:20 +0000</pubDate>
		<dc:creator>Trevoke</dc:creator>
				<category><![CDATA[ruby]]></category>
		<category><![CDATA[algorithms]]></category>
		<category><![CDATA[permutations]]></category>

		<guid isPermaLink="false">http://trevoke.net/blog/?p=199</guid>
		<description><![CDATA[Look, Ma, these are my baby steps in algorithms!]]></description>
			<content:encoded><![CDATA[<p>Look, Ma, these are my baby steps in algorithms!</p>
<pre class="brush: ruby; title: ; notranslate"># list is the elements to be permuted
# y is the number of results desired
# z is the number of elements per result
# equalizer keeps track of who got used how many times
def constrained_permutations list, y, z
  list.uniq! # Never trust the user. We want no repetitions.
  equalizer = {}
  list.each { |element| equalizer[element] = 0 }

  results = []
  # Do this until we get as many results as desired
  while results.size &lt; y
    pool = []
    puts pool
    least_used = equalizer.each_value.min
    # Find how used the least used element was
    while pool.size &lt; z
      # Do this until we have enough elements in this resultset
      element = nil
      while element.nil?
        # If we run out of &quot;least used elements&quot;, then we need to increment
        # our definition of &quot;least used&quot; by 1 and keep going.
        element = list.shuffle.find do |x|
          !pool.include?(x) &amp;&amp; equalizer[x] == least_used
        end
        least_used += 1 if element.nil?
      end
      equalizer[element] += 1
      # This element has now been used one more time.
      pool &lt;&lt; element
    end
    results &lt;&lt; pool
  end
  return results
end

constrained_permutations [0,1,2,3,4,5,6], 6, 2
=&gt; [[4, 0], [1, 3], [2, 5], [6, 0], [2, 5], [3, 6]]
constrained_permutations [0,1,2,3,4,5,6], 6, 2
=&gt; [[4, 5], [6, 3], [0, 2], [1, 6], [5, 4], [3, 0]]
</pre>
]]></content:encoded>
			<wfw:commentRss>http://trevoke.net/blog/2009/12/17/random-constrained-permutations-in-ruby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Inter-array permutations in Ruby</title>
		<link>http://trevoke.net/blog/2009/12/17/inter-array-permutations-in-ruby/</link>
		<comments>http://trevoke.net/blog/2009/12/17/inter-array-permutations-in-ruby/#comments</comments>
		<pubDate>Thu, 17 Dec 2009 17:51:06 +0000</pubDate>
		<dc:creator>Trevoke</dc:creator>
				<category><![CDATA[food for thought]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[permutations]]></category>

		<guid isPermaLink="false">http://trevoke.net/blog/?p=193</guid>
		<description><![CDATA[I don&#8217;t really have a better name for this. It&#8217;s also not completely clean, but it works. I had, almost a year ago (362 days ago), written a blog post about lexicographic permutations. That was about permutations of elements within one array. Someone on ruby-forum asked about permutations between multiple arrays. I found something in <a href='http://trevoke.net/blog/2009/12/17/inter-array-permutations-in-ruby/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t really have a better name for this. It&#8217;s also not completely clean, but it works. I had, almost a year ago (362 days ago), written a blog post about 
<a  href="http://trevoke.net/blog/2008/12/20/lexicographic-permutations-in-ruby" onclick="javascript:pageTracker._trackPageview('/external/trevoke.net/blog/2008/12/20/lexicographic-permutations-in-ruby');" >lexicographic permutations</a>. That was about permutations of elements within one array.<br />
Someone on ruby-forum asked about permutations between multiple arrays. I 
<a  href="http://stackoverflow.com/questions/710670/c-permutation-of-an-array-of-arraylists" onclick="javascript:pageTracker._trackPageview('/external/stackoverflow.com/questions/710670/c-permutation-of-an-array-of-arraylists');" >found something in C#</a>, which I was happy to transcribe to Ruby and tweak a little.</p>
<pre class="brush: ruby; title: ; notranslate">def array_permutations array, index=0
  # index is 0 by default : start at the beginning, more elegant.
  return array[-1] if index == array.size - 1 # Return last element if at end.
  result = []
  array[index].each do |element| # For each array
    array_permutations(array, index + 1).each do |x| # Permute permute permute
      result &lt;&lt; &quot;#{element}, #{x}&quot;
    end
  end
  return result
end</pre>
<p>So, we get this:</p>
<pre class="brush: ruby; title: ; notranslate">first = ['one', 'two']
second = ['three', 'four']
third = 'five', 'six']
result = array_permutations [first, second, third]
=&gt; [&quot;one, three, five&quot;, &quot;one, three, six&quot;, &quot;one, four, five&quot;, &quot;one, four, six&quot;, &quot;two, three, five&quot;, &quot;two, thre
e, six&quot;, &quot;two, four, five&quot;, &quot;two, four, six&quot;]</pre>
<p>Magic!</p>
<p>&#8212;&#8212;<br />
Edit &#8211; of course, my solution is hackish, and someone came up with a quicker and more elegant solution:</p>
<pre class="brush: ruby; title: ; notranslate">def fancy_array_permutation array
  return array[0] if array.size == 1
  first = array.shift
  return first.product( fancy_array_permutation(array) ).map {|x| x.flatten.join(&quot; &quot;)}
end</pre>
<p>This gives the same result as above.</p>
]]></content:encoded>
			<wfw:commentRss>http://trevoke.net/blog/2009/12/17/inter-array-permutations-in-ruby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Auto-vivifying hashes in Ruby</title>
		<link>http://trevoke.net/blog/2009/11/06/auto-vivifying-hashes-in-ruby/</link>
		<comments>http://trevoke.net/blog/2009/11/06/auto-vivifying-hashes-in-ruby/#comments</comments>
		<pubDate>Fri, 06 Nov 2009 13:27:09 +0000</pubDate>
		<dc:creator>Trevoke</dc:creator>
				<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://trevoke.net/blog/?p=178</guid>
		<description><![CDATA[An auto-vivifying hash is a hash that lets you create sub-hashes automatically. This means that the following code becomes possible: This is useful because it reduces the amount of logic in the code. No more &#8220;If sub-hash doesn&#8217;t exist, create it!&#8221; Courtesy of Robert Klemme on www.ruby-forum.com _____ Update: Facets has a way of doing <a href='http://trevoke.net/blog/2009/11/06/auto-vivifying-hashes-in-ruby/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>An auto-vivifying hash is a hash that lets you create sub-hashes automatically. This means that the following code becomes possible:</p>
<pre class="brush: plain; title: ; notranslate">def cnh # silly name &quot;create nested hash&quot;
  Hash.new {|h,k| h[k] = Hash.new(&amp;h.default_proc)}
end
my_hash = cnh
my_hash[1][2][3] = 4
my_hash # =&gt; { 1 =&gt; { 2 =&gt; { 3 =&gt;4 } } }
</pre>
<p>This is useful because it reduces the amount of logic in the code. No more &#8220;If sub-hash doesn&#8217;t exist, create it!&#8221;</p>
<p>Courtesy of Robert Klemme on www.ruby-forum.com</p>
<p>_____</p>
<p>Update:</p>
<p>Facets has a way of doing an auto-vivifying hash, too! Thanks to 
<a  href="http://stackoverflow.com/questions/1503671/ruby-hash-autovivification-facets" onclick="javascript:pageTracker._trackPageview('/external/stackoverflow.com/questions/1503671/ruby-hash-autovivification-facets');" >Stackoverflow</a>.</p>
<div>
<div>
<pre class="brush: plain; title: ; notranslate">
# Monkey patching Hash class:
# File lib/core/facets/hash/autonew.rb, line 19
  def self.autonew(*args)
    leet = lambda { |hsh, key| hsh[key] = new( &amp;leet ) }
    new(*args,&amp;leet)
  end
</pre>
</div>
</div>
<div>
<div>
<div>
<p>The standard 
<a rel="nofollow"  href="http://ruby-doc.org/core/classes/Hash.html#M002840" onclick="javascript:pageTracker._trackPageview('/external/ruby-doc.org/core/classes/Hash.html?M002840');" >new  method for Hash</a> accepts a block. This block is called in the event  of trying to access a key in the Hash which does not exist. The block is  passed the Hash itself and the key that was requested (the two  parameters) and should return the value that should be returned for the  requested key.</p>
<p>You will notice that the <code>leet</code> lambda does 2 things. It  returns a new Hash with <code>leet</code> itself as the block for  handling defaults. This is the behaviour which allows <code>autonew</code> to work for Hashes of arbitrary depth. It also assigns this new Hash to  <code>hsh[key]</code> so that next time you request the same key you  will get the existing Hash rather than a new one being created.</p>
<p>Sweet deal!</p>
</div>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://trevoke.net/blog/2009/11/06/auto-vivifying-hashes-in-ruby/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>SGF Parser updated</title>
		<link>http://trevoke.net/blog/2009/10/12/sgf-parser-updated/</link>
		<comments>http://trevoke.net/blog/2009/10/12/sgf-parser-updated/#comments</comments>
		<pubDate>Mon, 12 Oct 2009 18:04:02 +0000</pubDate>
		<dc:creator>Trevoke</dc:creator>
				<category><![CDATA[ruby]]></category>
		<category><![CDATA[weiqi]]></category>
		<category><![CDATA[sgf]]></category>
		<category><![CDATA[sgfparser]]></category>

		<guid isPermaLink="false">http://trevoke.net/blog/?p=168</guid>
		<description><![CDATA[Someday I&#8217;ll come out with a proper revision numbering scheme for it. I&#8217;ve implemented some Cucumber testing, the code now actually parses SGF files properly, including the KGS ones, it&#8217;ll work on Ruby 1.8.6, 1.8.7, 1.9.1, so .. It&#8217;s all good on that front. The code&#8217;s not as clean as I&#8217;d like it to be, <a href='http://trevoke.net/blog/2009/10/12/sgf-parser-updated/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Someday I&#8217;ll come out with a proper revision numbering scheme for it.<br />
I&#8217;ve implemented some 
<a  href="http://cukes.info/" onclick="javascript:pageTracker._trackPageview('/external/cukes.info/');" >Cucumber</a> testing, the code now <em>actually</em> parses SGF files properly, including the KGS ones, it&#8217;ll work on Ruby 1.8.6, 1.8.7, 1.9.1, so .. It&#8217;s all good on that front.</p>
<p>The code&#8217;s not as clean as I&#8217;d like it to be, and probably not as commented, either.</p>
<p>http://github.com/Trevoke/SGFParser</p>
<p>I am not -saving- SGF files with it yet, but heck if I&#8217;m not parsing them. And now YOU can, too !</p>
]]></content:encoded>
			<wfw:commentRss>http://trevoke.net/blog/2009/10/12/sgf-parser-updated/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ruby SGF Parser</title>
		<link>http://trevoke.net/blog/2009/09/15/ruby-sgf-parser/</link>
		<comments>http://trevoke.net/blog/2009/09/15/ruby-sgf-parser/#comments</comments>
		<pubDate>Wed, 16 Sep 2009 04:20:17 +0000</pubDate>
		<dc:creator>Trevoke</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[weiqi]]></category>
		<category><![CDATA[go]]></category>
		<category><![CDATA[sgf]]></category>

		<guid isPermaLink="false">http://trevoke.net/blog/?p=148</guid>
		<description><![CDATA[So, I play weiqi (known as the game of go, but I prefer using the chinese name). There are some SGF parsers out there for Ruby, but I wanted to write my own &#8211; the other ones didn&#8217;t seem comprehensive enough, didn&#8217;t seem Ruby-like enough in their objectifiying the women data. My original goal was <a href='http://trevoke.net/blog/2009/09/15/ruby-sgf-parser/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>So, I play weiqi (known as the game of go, but I prefer using the chinese name).<br />
There are some SGF parsers out there for Ruby, but I wanted to write my own &#8211; the other ones didn&#8217;t seem comprehensive enough, didn&#8217;t seem Ruby-like enough in their objectifiying the <del datetime="2009-09-16T04:15:45+00:00">women</del> data.<br />
My original goal was twofold: write a script to rename all the SGF files in my collection so they can be easily parsed later, and &#8230; Learn more Ruby!<br />
Here is the github link: http://github.com/Trevoke/SGFParser<br />
It&#8217;s a work in progress. Right now it parses the SGF file properly, but the user has a fair amount of work to do to use the data.. Which, maybe, is the way it needs to be. But I&#8217;m gonna try to follow the principle of least surprise to the bitter end! <img src='http://trevoke.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://trevoke.net/blog/2009/09/15/ruby-sgf-parser/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ruby on Rails + Sybase</title>
		<link>http://trevoke.net/blog/2009/07/31/ruby-on-rails-sybase/</link>
		<comments>http://trevoke.net/blog/2009/07/31/ruby-on-rails-sybase/#comments</comments>
		<pubDate>Fri, 31 Jul 2009 14:32:27 +0000</pubDate>
		<dc:creator>Trevoke</dc:creator>
				<category><![CDATA[databases]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[sybase]]></category>

		<guid isPermaLink="false">http://trevoke.net/blog/2009/07/31/ruby-on-rails-sybase/</guid>
		<description><![CDATA[Caveat: This adapter may only work with the enterprise edition of Sybase (i.e. Sybase ASE) not with SQLAnywhere (Sybase ASA) gem install activerecord-sybase-adapter -s http://gems.rubyonrails.org ActiveRecord::Base.establish_connection( :adapter => &#8220;sybase&#8221;, :database => &#8220;test&#8221;, :host => &#8220;www.yourdbserver.com&#8221;, :username => &#8220;kevin&#8221;, :password => &#8220;test&#8221;) Play!]]></description>
			<content:encoded><![CDATA[<p>Caveat: This adapter may only work with the enterprise edition of Sybase (i.e. Sybase ASE) not with SQLAnywhere (Sybase ASA)</p>
<p>gem install activerecord-sybase-adapter -s http://gems.rubyonrails.org</p>
<p>ActiveRecord::Base.establish_connection(<br />
:adapter => &#8220;sybase&#8221;,<br />
:database => &#8220;test&#8221;,<br />
:host => &#8220;www.yourdbserver.com&#8221;,<br />
:username => &#8220;kevin&#8221;,<br />
:password => &#8220;test&#8221;)</p>
<p>Play!</p>
]]></content:encoded>
			<wfw:commentRss>http://trevoke.net/blog/2009/07/31/ruby-on-rails-sybase/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.319 seconds -->

