Last active
July 16, 2020 19:08
-
-
Save apotterri/5dbe76a39d2af565facc84e3b49049a2 to your computer and use it in GitHub Desktop.
appmap before and after
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
5dbe76a39d2af565facc84e3b49049a2 |
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
2.6.2 |
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
name: appland/singleton methods | |
packages: | |
- path: test.rb |
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
source 'https://rubygems.org' | |
git_source(:github) { |repo| "https://github.com/#{repo}.git" } | |
ruby '~> 2.6' | |
gem 'appmap', '~> 0.28.0', | |
git: 'https://github.com/applandinc/appmap-ruby', | |
branch: 'master' |
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
module AddMethod | |
def self.included(base) | |
base.module_eval do | |
define_method 'new_method' do | |
"it's a new method" | |
end | |
end | |
end | |
end | |
class Foo | |
def self.static_method | |
"it's a static method" | |
end | |
def do_include | |
$stderr.puts singleton_class.ancestors.inspect | |
Foo.include AddMethod | |
$stderr.puts singleton_class.ancestors.inspect | |
end | |
end | |
Foo.static_method | |
f = Foo.new | |
f.do_include | |
f.new_method | |
class Bar | |
def do_include | |
class << self | |
$stderr.puts ancestors.inspect | |
include AddMethod | |
$stderr.puts ancestors.inspect | |
end | |
end | |
end | |
b = Bar.new | |
b.do_include | |
b.new_method |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment