Last active
November 2, 2015 19:42
-
-
Save jtrim/750c081d762856e150e1 to your computer and use it in GitHub Desktop.
This file contains 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 'yaml' | |
require 'busted' | |
require 'ostruct' | |
obj = Object.new | |
module Stuff | |
def bar | |
end | |
end | |
module Fooo | |
def baar | |
puts "bar" | |
end | |
end | |
results = [ | |
"Busted.cache? { Class.new }", | |
"Busted.cache? { Class.new { def foo; end } }", | |
"Busted.cache? { Klass = Class.new { def foo; end } }", | |
"Busted.cache? { class Foo; end }", | |
"Busted.cache? { obj.extend(Stuff) }", | |
"Busted.cache? { def obj.do_a_thing; end }", | |
"Busted.cache? { obj.extend(Fooo) }", | |
"Busted.cache? { OpenStruct.new(foo: 'foo', bar: 'bar') }", | |
"Busted.cache? { thing = OpenStruct.new(foo: 'foo', bar: 'bar') }" | |
].map { |c| [c, eval(c, binding)] } | |
results.each { |(command, result)| puts "- #{command}\n => #{result}" } |
Author
jtrim
commented
Nov 2, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment