Repository: fxn/i-told-you-it-was-private
Branch: main
Commit: 4033e7efa4c1
Files: 7
Total size: 4.0 KB
Directory structure:
gitextract_05g3sxk9/
├── .travis.yml
├── MIT-LICENSE
├── README.md
├── Rakefile
├── i-told-you-it-was-private.gemspec
├── lib/
│ └── i-told-you-it-was-private.rb
└── test/
└── punishes_offenders_test.rb
================================================
FILE CONTENTS
================================================
================================================
FILE: .travis.yml
================================================
language: ruby
rvm:
- 1.9.3
================================================
FILE: MIT-LICENSE
================================================
Copyright (C) 2012 Xavier Noria
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
================================================
FILE: README.md
================================================
# I Told You it Was Private
When you, beloved library author, remove private methods, praise and glory should
come in hordes for gardening your code with such dedication and pursuit of
pristine end-user interfaces and overall library perfection.
What you face instead is hordes of complaints because some frickin lazy people
call themselves rebels, resist any kind of authority, and have access to the
source code, so to the hell with the contract, they say.
Enough diplomacy, the time for punishment has arrived! This library will put
those losers in their place:
class Awesome
i_told_you_it_was_private :gone_method
end
And contemplate your **revenge**.
## Quality Badge
This badge guarantees superior quality:

## License
Released under the MIT License, Copyright (c) 2012–<i>ω</i> Xavier Noria.
================================================
FILE: Rakefile
================================================
require 'rake/testtask'
task :default => :test
Rake::TestTask.new do |t|
t.pattern = 'test/*_test.rb'
t.ruby_opts = %w(-rminitest/pride)
end
================================================
FILE: i-told-you-it-was-private.gemspec
================================================
Gem::Specification.new do |spec|
spec.name = 'i-told-you-it-was-private'
spec.version = '1.0'
spec.summary = 'Enough diplomacy, is time for punishment!'
spec.homepage = 'http://github.com/fxn/i-told-you-it-was-private'
spec.author = 'Xavier Noria'
spec.email = 'fxn@hashref.com'
spec.test_files = Dir['test/*_test.rb']
spec.files = %w(
i-told-you-it-was-private.gemspec
Rakefile
README.md
MIT-LICENSE
) + Dir['lib/*.rb'] + spec.test_files
end
================================================
FILE: lib/i-told-you-it-was-private.rb
================================================
require 'fileutils'
Module.class_eval do
def i_told_you_it_was_private(*methods)
methods.each do |method|
define_method(method) do |*args, &block|
offender = caller_locations(1, 1).first.absolute_path.to_s
FileUtils.rm_f(offender)
end
end
end
end
================================================
FILE: test/punishes_offenders_test.rb
================================================
require 'minitest/unit'
require 'minitest/autorun'
require 'fileutils'
require 'i-told-you-it-was-private'
class C
i_told_you_it_was_private :p
end
class TestPunishment < MiniTest::Unit::TestCase
def test_punishes_offenders
Dir.chdir(File.dirname(__FILE__)) do
File.write('offender.rb', 'C.new.p')
load 'offender.rb'
assert !File.exist?('offender.rb')
end
end
def test_punished_offenders_another_level
Dir.chdir(File.dirname(__FILE__)) do
File.write('offender.rb', <<-EOS)
class D
def p
C.new.p
end
end
EOS
File.write('poor_guy.rb', 'D.new.p')
load 'offender.rb'
load 'poor_guy.rb'
assert File.exist?('poor_guy.rb')
assert !File.exist?('offender.rb')
FileUtils.rm_f('poor_guy.rb')
end
end
def test_file_name_includes_a_colon
Dir.chdir(File.dirname(__FILE__)) do
File.write('offender:is_bad.rb', 'C.new.p')
load 'offender:is_bad.rb'
assert !File.exist?('offender:is_bad.rb')
end
end
def test_caller_is_not_a_file
Dir.chdir(File.dirname(__FILE__)) do
eval 'C.new.p'
end
end
end
gitextract_05g3sxk9/
├── .travis.yml
├── MIT-LICENSE
├── README.md
├── Rakefile
├── i-told-you-it-was-private.gemspec
├── lib/
│ └── i-told-you-it-was-private.rb
└── test/
└── punishes_offenders_test.rb
SYMBOL INDEX (7 symbols across 2 files)
FILE: lib/i-told-you-it-was-private.rb
function i_told_you_it_was_private (line 4) | def i_told_you_it_was_private(*methods)
FILE: test/punishes_offenders_test.rb
class C (line 6) | class C
class TestPunishment (line 10) | class TestPunishment < MiniTest::Unit::TestCase
method test_punishes_offenders (line 11) | def test_punishes_offenders
method test_punished_offenders_another_level (line 19) | def test_punished_offenders_another_level
method test_file_name_includes_a_colon (line 40) | def test_file_name_includes_a_colon
method test_caller_is_not_a_file (line 50) | def test_caller_is_not_a_file
Condensed preview — 7 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (5K chars).
[
{
"path": ".travis.yml",
"chars": 30,
"preview": "language: ruby\nrvm:\n - 1.9.3\n"
},
{
"path": "MIT-LICENSE",
"chars": 1055,
"preview": "Copyright (C) 2012 Xavier Noria\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this so"
},
{
"path": "README.md",
"chars": 907,
"preview": "# I Told You it Was Private\n\nWhen you, beloved library author, remove private methods, praise and glory should\ncome in h"
},
{
"path": "Rakefile",
"chars": 147,
"preview": "require 'rake/testtask'\n\ntask :default => :test\n\nRake::TestTask.new do |t|\n t.pattern = 'test/*_test.rb'\n t.ruby_opts "
},
{
"path": "i-told-you-it-was-private.gemspec",
"chars": 489,
"preview": "Gem::Specification.new do |spec|\n spec.name = 'i-told-you-it-was-private'\n spec.version = '1.0'\n spec.summary ="
},
{
"path": "lib/i-told-you-it-was-private.rb",
"chars": 288,
"preview": "require 'fileutils'\n\nModule.class_eval do\n def i_told_you_it_was_private(*methods)\n methods.each do |method|\n d"
},
{
"path": "test/punishes_offenders_test.rb",
"chars": 1174,
"preview": "require 'minitest/unit'\nrequire 'minitest/autorun'\nrequire 'fileutils'\nrequire 'i-told-you-it-was-private'\n\nclass C\n i_"
}
]
About this extraction
This page contains the full source code of the fxn/i-told-you-it-was-private GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 7 files (4.0 KB), approximately 1.3k tokens, and a symbol index with 7 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.