On Tue, Jan 13, 2009 at 12:48 PM, Charles Oliver Nutter
<charles.nutter / sun.com> wrote:
>
> Is this correct? I strongly believe Proc should not be usable as a binding,
> since I believe it is a breach of trust:

As an experiment to reduce repetitive code, I created some methods
which translate between locals, hashes, instance variables, and config
files.  For example,

require 'quix/vars'

def f(opts)
  a, b, c = nil
  Quix::Vars.hash_to_locals { opts }
  p b
end

f(:a => 66, :b => 77, :c => 88)  #=> 77

class A
  attr_reader :x, :y, :z
  def initialize(x, y, z)
    Quix::Vars.locals_to_ivs {%{x, y, z}}
  end
end

p A.new(33, 44, 55).y  #=> 44

Though my intent here is a bit unserious, I have found a few uses for
it.  Even if you (understandably) think it's evil, deciding to remove
the functionality might be a little drastic.

http://github.com/quix/quix/blob/master/test/test_vars.rb

James M. Lawrence