Skip to content

Instantly share code, notes, and snippets.

View severin's full-sized avatar

Severin Schoepke severin

  • Zürich, Switzerland
View GitHub Profile
@severin
severin / Gemfile
Created March 22, 2010 13:12 — forked from samgranieri/Gemfile
How to set up Bundler in a Rails 2 app
source :gemcutter
gem 'rails', '~> 2.3.5', :require => nil
@severin
severin / floppy.rb
Created February 8, 2010 22:15 — forked from pjb3/floppy.rb
assigning Procs as methods in Ruby
class Floppy
def method_missing(method, *args)
super unless args.length > 0 && method.to_s[-1..-1] == "="
if args.first.is_a?(Proc)
(class << self; self; end).class_eval do
define_method(method.to_s[0..-2].to_sym, args.first)
end
else
(class << self; self; end).send(:attr_accessor, method.to_s[0...-1])