Created
November 21, 2012 21:39
-
-
Save kenmazaika/4127974 to your computer and use it in GitHub Desktop.
Ruby Closure Issue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'rubygems' | |
| require 'active_support/all' | |
| module Haha | |
| extend ActiveSupport::Concern | |
| module ClassMethods | |
| def make_lol(&block) | |
| define_method :lol do | |
| puts instance_eval &block | |
| end | |
| end | |
| end | |
| end | |
| class Omg | |
| include Haha | |
| make_lol do | |
| stuff_to_buy | |
| end | |
| def stuff_to_buy | |
| "skeet_blanket" | |
| end | |
| end | |
| puts Omg.new.lol | |
| #[ruby-1.9.3@campaign_manager](archive-CMGR-1760):campaign_manager$ ruby omglol.rb | |
| #skeet_blanket |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment