Skip to content

Instantly share code, notes, and snippets.

@jrgriffiniii
Created August 8, 2017 13:32
Show Gist options
  • Save jrgriffiniii/8cf9ab64d4ecaff44a2f59284d23ba85 to your computer and use it in GitHub Desktop.
Save jrgriffiniii/8cf9ab64d4ecaff44a2f59284d23ba85 to your computer and use it in GitHub Desktop.
Module Refactor Failures
#!/usr/bin/env ruby
require 'pry'
module MyModule
def foo
'foo'
end
def self.included(base)
def bar
binding.pry
'bar'
end
end
end
module MyOtherModule
include MyModule
def baz
'baz'
end
end
class MyClass
include MyOtherModule
end
my_modules.rb @ line 11 MyModule#bar:
9: def bar
10: binding.pry
=> 11: 'bar'
12: end
[1] pry(#<MyClass>)> ls
MyModule#methods: bar foo
MyOtherModule#methods: baz
locals: _ __ _dir_ _ex_ _file_ _in_ _out_ _pry_
[2] pry(#<MyClass>)> self
=> #<MyClass:0x007fd4cd085aa8>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment