Skip to content

Instantly share code, notes, and snippets.

@aarongough
Created July 12, 2010 19:14
Show Gist options
  • Save aarongough/472923 to your computer and use it in GitHub Desktop.
Save aarongough/472923 to your computer and use it in GitHub Desktop.
basic_object[:slots][:add_method] = Proc.new do |this, params|
puts "ERR: add_method called without method key" and return unless(params.first.is_a?(String) || params.first.is_a?(Symbol))
puts "ERR: add_method called without block" and return unless(params.last.is_a?(Proc))
this[:slots][params.first.to_sym] = params.last
this[:size] += 1
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment