crazy_pills 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 237a11be2006c3997ef9ef4331bfe03122412530
4
- data.tar.gz: 62e8d9c535a81bbde227197b35719d4471c23e8f
3
+ metadata.gz: f6282beffaf0e17f59175d1d9b0cdbacc335f72d
4
+ data.tar.gz: 5781036a182ca5d74bcb822537d48f56e0667a0c
5
5
  SHA512:
6
- metadata.gz: 1ab973708f3f60be474e4b0b5d144f1b25d1eb630292c0a367c362348a80a1f95f6347da99d9ca46b1830ce0e6ac36ee5cfaccc54a48e26b1c43c0f50010be74
7
- data.tar.gz: 5ab94d9a1509a5885e7ae8120fabd9329b8ba27fe2ea66a4153fed502c676a46707d8d15e7373d94c23a60174d76e6f3f54ba9ef2981af960eeba1a307991670
6
+ metadata.gz: 29f6aa4a4f086512ed4965694f646c17d22b095bb62641d5b6c5106e17c7143dd4de877af98dc622503997a2e51b377fdbf093e2efd585425942e05e4d395fe4
7
+ data.tar.gz: 57f1e3eb39760c433b5f8eadcdb476e02e654a5dd4b07806d63f7ad6a17bf591b8bf70afbe3c79d224c70fe4c7c4f68b9ec1a8b98850ea9a2288abd504a0e7b8
data/README.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # CrazyPills
2
2
 
3
- TODO: Write a gem description
3
+ You should never use CrazyPills in your application.
4
+
5
+ By requiring CrazyPills you are randomly removing and/or nil-ifying
6
+ a random method of one of many of the core classes of the Ruby
7
+ interpreter. It is really a bad idea to use it.
4
8
 
5
9
  ## Installation
6
10
 
@@ -18,7 +22,53 @@ Or install it yourself as:
18
22
 
19
23
  ## Usage
20
24
 
21
- TODO: Write usage instructions here
25
+ If you want to know which method got "crazy-fied" then just ask crazy pills
26
+
27
+ ```ruby
28
+ require 'crazy_pills'
29
+
30
+ CrazyPills.explain
31
+ # Made Object#is_a? just return nil
32
+ ```
33
+
34
+ If you want to make it get realllllll crazy, just up the level of crazy
35
+
36
+ HOW_CRAZY=10 bundle exec irb
37
+
38
+ ```ruby
39
+ require 'crazy_pills'
40
+
41
+ CrazyPills.explain
42
+ # Made Float#to_enum just return nil
43
+ # Made String#capitalize just return nil
44
+ # Made Exception#untrust just return nil
45
+ # Aliased Float#coerce to Float#%
46
+ # Aliased Exception#define_singleton_method to Exception#method
47
+ # Aliased Hash#! to Hash#equal?
48
+ # Aliased Object#<=> to Object#nil?
49
+ # Aliased Object#taint to Object#gem
50
+ # Aliased Exception#public_method to Exception#class
51
+ # Aliased Exception#!= to Exception#protected_methods
52
+ ```
53
+
54
+ And if you need to debug, then just pass a DEBUG flag
55
+
56
+ DEBUG=1 HOW_CRAZY=10 bundle exec irb
57
+
58
+ ```ruby
59
+ require 'crazy_pills'
60
+
61
+ # Nil-ify Exception#trust
62
+ # Aliased ["File#to_a", "File#grep"]
63
+ # Aliased ["String#chop!", "String#object_id"]
64
+ # Aliased ["Numeric#__send__", "Numeric#remove_instance_variable"]
65
+ # Nil-ify Hash#!
66
+ # Nil-ify File#methods
67
+ # Nil-ify Float#gem
68
+ # Nil-ify Object#define_singleton_method
69
+ # Nil-ify Numeric#zero?
70
+ # Nil-ify Exception#__id__
71
+ ```
22
72
 
23
73
  ## Contributing
24
74
 
@@ -23,6 +23,7 @@ module CrazyPills
23
23
  def self.aliased(*args)
24
24
  @aliased ||= []
25
25
  @aliased.concat(args) if args
26
+ puts "Aliased #{args}" if ENV['DEBUG']
26
27
  @aliased
27
28
  end
28
29
 
@@ -45,11 +46,13 @@ module CrazyPills
45
46
 
46
47
  method_to_crazy = class_to_crazy.instance_methods.sample
47
48
 
48
- if Time.now.to_i % 3 == 1
49
+ if [true, false].sample
49
50
  self.made_nil("#{class_to_crazy}##{method_to_crazy}")
50
51
 
51
- class_to_crazy.define_method(method_to_crazy) do
52
- nil
52
+ class_to_crazy.class_eval do
53
+ define_method(method_to_crazy) do
54
+ nil
55
+ end
53
56
  end
54
57
  else
55
58
  alias_to = class_to_crazy.instance_methods.sample
@@ -64,10 +67,11 @@ module CrazyPills
64
67
  def self.made_nil(name = nil)
65
68
  @made_nil ||= []
66
69
  @made_nil << name if name
70
+ puts "Nil-ify #{name}" if ENV['DEBUG']
67
71
  @made_nil
68
72
  end
69
73
 
70
- (ENV['HOW_CRAZY'] || ENV['CRAZY'] || 1).times do
74
+ (ENV['HOW_CRAZY'] || ENV['CRAZY'] || 1).to_i.times do
71
75
  lets_get_crazy!(*THINGS_TO_CRAZY)
72
76
  end
73
77
  end
@@ -1,3 +1,3 @@
1
1
  module CrazyPills
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crazy_pills
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Dewitt