fuck 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,5 @@
1
1
  require "fuck/version"
2
- require "fuck/sort"
3
- require "fuck/map"
2
+ require "fuck/penalize"
4
3
 
5
4
  module Fuck
6
5
  # Your code goes here...
@@ -0,0 +1,44 @@
1
+ module Fuck
2
+ module Penalize
3
+
4
+ module ActionController
5
+ @@seconds = 0.01
6
+
7
+ def self.seconds
8
+ @@seconds
9
+ end
10
+
11
+ def self.penalize(seconds)
12
+ @@seconds = seconds
13
+ require 'fuck/penalize/action_controller'
14
+ end
15
+ end
16
+
17
+ module Map
18
+ @@count = 100
19
+
20
+ def self.count
21
+ @@count
22
+ end
23
+
24
+ def self.penalize(count)
25
+ @@count = count
26
+ require 'fuck/penalize/map'
27
+ end
28
+ end
29
+
30
+ module Sort
31
+ @@count = 100
32
+
33
+ def self.count
34
+ @@count
35
+ end
36
+
37
+ def self.penalize(count)
38
+ @@count = count
39
+ require 'fuck/penalize/sort'
40
+ end
41
+ end
42
+
43
+ end
44
+ end
@@ -0,0 +1,9 @@
1
+ class ActionController::Base
2
+ class_exec do
3
+ before_filter :slow_down
4
+
5
+ def slow_down
6
+ sleep Fuck::Penalize::ActionController.seconds
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,15 @@
1
+ class Array
2
+ alias :real_map :map
3
+ alias :real_inject :inject
4
+
5
+ def map(*args, &block)
6
+ Fuck::Penalize::Map.count.times {}
7
+ real_map(*args, &block)
8
+ end
9
+
10
+ def inject(*args, &block)
11
+ Fuck::Penalize::Map.count.times {}
12
+ real_inject(*args, &block)
13
+ end
14
+
15
+ end
@@ -3,7 +3,7 @@ class Array
3
3
  alias :real_sort :sort
4
4
 
5
5
  def sort(*args)
6
- sleep 0.01
6
+ Fuck::Penalize::Sort.count.times { }
7
7
  real_sort(*args)
8
8
  end
9
9
 
@@ -1,3 +1,3 @@
1
1
  module Fuck
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -1 +1,3 @@
1
1
  require 'fuck'
2
+ Fuck::Penalize::Map.penalize(1000)
3
+ Fuck::Penalize::Sort.penalize(1000)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fuck
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-23 00:00:00.000000000 Z
12
+ date: 2012-03-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70308380052320 !ruby/object:Gem::Requirement
16
+ requirement: &70265300387680 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70308380052320
24
+ version_requirements: *70265300387680
25
25
  description: Makes things slower, so you have to optimize the hard stuff first.
26
26
  email:
27
27
  - jkrueger@enova.com
@@ -34,8 +34,10 @@ files:
34
34
  - Rakefile
35
35
  - fuck.gemspec
36
36
  - lib/fuck.rb
37
- - lib/fuck/map.rb
38
- - lib/fuck/sort.rb
37
+ - lib/fuck/penalize.rb
38
+ - lib/fuck/penalize/action_controller.rb
39
+ - lib/fuck/penalize/map.rb
40
+ - lib/fuck/penalize/sort.rb
39
41
  - lib/fuck/version.rb
40
42
  - script/sort_timing.rb
41
43
  - spec/fuck_spec.rb
@@ -1,10 +0,0 @@
1
- class Array
2
-
3
- alias :real_map :map
4
-
5
- def map(*args, &block)
6
- sleep 0.01
7
- real_map(*args, &block)
8
- end
9
-
10
- end