bullet 4.0.0 → 4.1.1

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.
data/.gitignore CHANGED
@@ -8,3 +8,4 @@ tags
8
8
  .bundle
9
9
  *.gem
10
10
  benchmark_profile*
11
+ /nbproject/private/
data/.travis.yml CHANGED
@@ -3,7 +3,9 @@ rvm:
3
3
  - 1.9.3
4
4
  gemfile:
5
5
  - Gemfile
6
- - Gemfile.rails-3.1.4
7
- - Gemfile.rails-3.0.12
6
+ - Gemfile.rails-3.1.5
7
+ - Gemfile.rails-3.0.13
8
8
  - Gemfile.rails-2.3.14
9
9
  env: DB=sqlite
10
+ before_install:
11
+ - echo "yes" | gem uninstall json
data/Gemfile CHANGED
@@ -4,12 +4,11 @@ source "http://rubygems.org"
4
4
 
5
5
  gemspec
6
6
 
7
- gem 'rails', '3.2.3'
7
+ gem 'rails', '3.2.5'
8
8
  gem 'sqlite3'
9
9
  gem 'mysql'
10
10
  gem 'activerecord-import'
11
- gem 'mongoid'
12
- gem 'bson_ext'
11
+ gem 'mongoid', '3.0.0.rc'
13
12
 
14
13
  gem "rspec"
15
14
  gem "guard"
data/Gemfile.lock CHANGED
@@ -1,46 +1,43 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bullet (4.0.0)
4
+ bullet (4.1.1)
5
5
  uniform_notifier (~> 1.0.0)
6
6
 
7
7
  GEM
8
8
  remote: http://rubygems.org/
9
9
  specs:
10
- actionmailer (3.2.3)
11
- actionpack (= 3.2.3)
10
+ actionmailer (3.2.5)
11
+ actionpack (= 3.2.5)
12
12
  mail (~> 2.4.4)
13
- actionpack (3.2.3)
14
- activemodel (= 3.2.3)
15
- activesupport (= 3.2.3)
13
+ actionpack (3.2.5)
14
+ activemodel (= 3.2.5)
15
+ activesupport (= 3.2.5)
16
16
  builder (~> 3.0.0)
17
17
  erubis (~> 2.7.0)
18
18
  journey (~> 1.0.1)
19
19
  rack (~> 1.4.0)
20
20
  rack-cache (~> 1.2)
21
21
  rack-test (~> 0.6.1)
22
- sprockets (~> 2.1.2)
23
- activemodel (3.2.3)
24
- activesupport (= 3.2.3)
22
+ sprockets (~> 2.1.3)
23
+ activemodel (3.2.5)
24
+ activesupport (= 3.2.5)
25
25
  builder (~> 3.0.0)
26
- activerecord (3.2.3)
27
- activemodel (= 3.2.3)
28
- activesupport (= 3.2.3)
26
+ activerecord (3.2.5)
27
+ activemodel (= 3.2.5)
28
+ activesupport (= 3.2.5)
29
29
  arel (~> 3.0.2)
30
30
  tzinfo (~> 0.3.29)
31
31
  activerecord-import (0.2.9)
32
32
  activerecord (~> 3.0)
33
33
  activerecord (~> 3.0)
34
- activeresource (3.2.3)
35
- activemodel (= 3.2.3)
36
- activesupport (= 3.2.3)
37
- activesupport (3.2.3)
34
+ activeresource (3.2.5)
35
+ activemodel (= 3.2.5)
36
+ activesupport (= 3.2.5)
37
+ activesupport (3.2.5)
38
38
  i18n (~> 0.6)
39
39
  multi_json (~> 1.0)
40
40
  arel (3.0.2)
41
- bson (1.6.2)
42
- bson_ext (1.6.2)
43
- bson (~> 1.6.2)
44
41
  builder (3.0.0)
45
42
  diff-lcs (1.1.3)
46
43
  erubis (2.7.0)
@@ -53,20 +50,21 @@ GEM
53
50
  hike (1.2.1)
54
51
  i18n (0.6.0)
55
52
  journey (1.0.3)
56
- json (1.7.0)
53
+ json (1.7.3)
57
54
  mail (2.4.4)
58
55
  i18n (>= 0.4.0)
59
56
  mime-types (~> 1.16)
60
57
  treetop (~> 1.4.8)
61
58
  mime-types (1.18)
62
- mongo (1.6.2)
63
- bson (~> 1.6.2)
64
- mongoid (2.4.9)
59
+ mongoid (3.0.0.rc)
65
60
  activemodel (~> 3.1)
66
- mongo (~> 1.3)
61
+ moped (~> 1.0.0.rc)
62
+ origin (~> 1.0.0.rc)
67
63
  tzinfo (~> 0.3.22)
68
- multi_json (1.3.4)
64
+ moped (1.0.0.rc)
65
+ multi_json (1.3.6)
69
66
  mysql (2.8.1)
67
+ origin (1.0.0.rc)
70
68
  perftools.rb (2.0.0)
71
69
  polyglot (0.3.3)
72
70
  rack (1.4.1)
@@ -76,21 +74,21 @@ GEM
76
74
  rack
77
75
  rack-test (0.6.1)
78
76
  rack (>= 1.0)
79
- rails (3.2.3)
80
- actionmailer (= 3.2.3)
81
- actionpack (= 3.2.3)
82
- activerecord (= 3.2.3)
83
- activeresource (= 3.2.3)
84
- activesupport (= 3.2.3)
77
+ rails (3.2.5)
78
+ actionmailer (= 3.2.5)
79
+ actionpack (= 3.2.5)
80
+ activerecord (= 3.2.5)
81
+ activeresource (= 3.2.5)
82
+ activesupport (= 3.2.5)
85
83
  bundler (~> 1.0)
86
- railties (= 3.2.3)
87
- railties (3.2.3)
88
- actionpack (= 3.2.3)
89
- activesupport (= 3.2.3)
84
+ railties (= 3.2.5)
85
+ railties (3.2.5)
86
+ actionpack (= 3.2.5)
87
+ activesupport (= 3.2.5)
90
88
  rack-ssl (~> 1.3.2)
91
89
  rake (>= 0.8.7)
92
90
  rdoc (~> 3.4)
93
- thor (~> 0.14.6)
91
+ thor (>= 0.14.6, < 2.0)
94
92
  rake (0.9.2.2)
95
93
  rdoc (3.12)
96
94
  json (~> 1.4)
@@ -120,13 +118,12 @@ PLATFORMS
120
118
 
121
119
  DEPENDENCIES
122
120
  activerecord-import
123
- bson_ext
124
121
  bullet!
125
122
  guard
126
123
  guard-rspec
127
- mongoid
124
+ mongoid (= 3.0.0.rc)
128
125
  mysql
129
126
  perftools.rb
130
- rails (= 3.2.3)
127
+ rails (= 3.2.5)
131
128
  rspec
132
129
  sqlite3
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bullet (2.3.1)
4
+ bullet (4.1.1)
5
5
  uniform_notifier (~> 1.0.0)
6
6
 
7
7
  GEM
@@ -4,7 +4,7 @@ source "http://rubygems.org"
4
4
 
5
5
  gemspec
6
6
 
7
- gem 'rails', '3.0.12'
7
+ gem 'rails', '3.0.13'
8
8
  gem 'sqlite3'
9
9
  gem 'mysql'
10
10
  gem 'activerecord-import'
@@ -1,19 +1,19 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bullet (2.3.1)
4
+ bullet (4.1.1)
5
5
  uniform_notifier (~> 1.0.0)
6
6
 
7
7
  GEM
8
8
  remote: http://rubygems.org/
9
9
  specs:
10
10
  abstract (1.0.0)
11
- actionmailer (3.0.12)
12
- actionpack (= 3.0.12)
11
+ actionmailer (3.0.13)
12
+ actionpack (= 3.0.13)
13
13
  mail (~> 2.2.19)
14
- actionpack (3.0.12)
15
- activemodel (= 3.0.12)
16
- activesupport (= 3.0.12)
14
+ actionpack (3.0.13)
15
+ activemodel (= 3.0.13)
16
+ activesupport (= 3.0.13)
17
17
  builder (~> 2.1.2)
18
18
  erubis (~> 2.6.6)
19
19
  i18n (~> 0.5.0)
@@ -21,22 +21,22 @@ GEM
21
21
  rack-mount (~> 0.6.14)
22
22
  rack-test (~> 0.5.7)
23
23
  tzinfo (~> 0.3.23)
24
- activemodel (3.0.12)
25
- activesupport (= 3.0.12)
24
+ activemodel (3.0.13)
25
+ activesupport (= 3.0.13)
26
26
  builder (~> 2.1.2)
27
27
  i18n (~> 0.5.0)
28
- activerecord (3.0.12)
29
- activemodel (= 3.0.12)
30
- activesupport (= 3.0.12)
28
+ activerecord (3.0.13)
29
+ activemodel (= 3.0.13)
30
+ activesupport (= 3.0.13)
31
31
  arel (~> 2.0.10)
32
32
  tzinfo (~> 0.3.23)
33
33
  activerecord-import (0.2.9)
34
34
  activerecord (~> 3.0)
35
35
  activerecord (~> 3.0)
36
- activeresource (3.0.12)
37
- activemodel (= 3.0.12)
38
- activesupport (= 3.0.12)
39
- activesupport (3.0.12)
36
+ activeresource (3.0.13)
37
+ activemodel (= 3.0.13)
38
+ activesupport (= 3.0.13)
39
+ activesupport (3.0.13)
40
40
  arel (2.0.10)
41
41
  bson (1.6.2)
42
42
  bson_ext (1.6.2)
@@ -52,7 +52,7 @@ GEM
52
52
  guard-rspec (0.7.0)
53
53
  guard (>= 0.10.0)
54
54
  i18n (0.5.0)
55
- json (1.7.0)
55
+ json (1.7.3)
56
56
  mail (2.2.19)
57
57
  activesupport (>= 2.3.6)
58
58
  i18n (>= 0.4.0)
@@ -67,17 +67,17 @@ GEM
67
67
  rack (>= 1.0.0)
68
68
  rack-test (0.5.7)
69
69
  rack (>= 1.0)
70
- rails (3.0.12)
71
- actionmailer (= 3.0.12)
72
- actionpack (= 3.0.12)
73
- activerecord (= 3.0.12)
74
- activeresource (= 3.0.12)
75
- activesupport (= 3.0.12)
70
+ rails (3.0.13)
71
+ actionmailer (= 3.0.13)
72
+ actionpack (= 3.0.13)
73
+ activerecord (= 3.0.13)
74
+ activeresource (= 3.0.13)
75
+ activesupport (= 3.0.13)
76
76
  bundler (~> 1.0)
77
- railties (= 3.0.12)
78
- railties (3.0.12)
79
- actionpack (= 3.0.12)
80
- activesupport (= 3.0.12)
77
+ railties (= 3.0.13)
78
+ railties (3.0.13)
79
+ actionpack (= 3.0.13)
80
+ activesupport (= 3.0.13)
81
81
  rake (>= 0.8.7)
82
82
  rdoc (~> 3.4)
83
83
  thor (~> 0.14.4)
@@ -111,6 +111,6 @@ DEPENDENCIES
111
111
  guard-rspec
112
112
  mysql
113
113
  perftools.rb
114
- rails (= 3.0.12)
114
+ rails (= 3.0.13)
115
115
  rspec
116
116
  sqlite3
@@ -4,11 +4,11 @@ source "http://rubygems.org"
4
4
 
5
5
  gemspec
6
6
 
7
- gem 'rails', '3.1.4'
7
+ gem 'rails', '3.1.5'
8
8
  gem 'sqlite3'
9
9
  gem 'mysql'
10
10
  gem 'activerecord-import'
11
- gem 'mongoid'
11
+ gem 'mongoid', '2.4.10'
12
12
  gem 'bson_ext'
13
13
 
14
14
  gem "rspec"
@@ -1,43 +1,43 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bullet (2.3.1)
4
+ bullet (4.1.1)
5
5
  uniform_notifier (~> 1.0.0)
6
6
 
7
7
  GEM
8
8
  remote: http://rubygems.org/
9
9
  specs:
10
- actionmailer (3.1.4)
11
- actionpack (= 3.1.4)
12
- mail (~> 2.3.0)
13
- actionpack (3.1.4)
14
- activemodel (= 3.1.4)
15
- activesupport (= 3.1.4)
10
+ actionmailer (3.1.5)
11
+ actionpack (= 3.1.5)
12
+ mail (~> 2.3.3)
13
+ actionpack (3.1.5)
14
+ activemodel (= 3.1.5)
15
+ activesupport (= 3.1.5)
16
16
  builder (~> 3.0.0)
17
17
  erubis (~> 2.7.0)
18
18
  i18n (~> 0.6)
19
19
  rack (~> 1.3.6)
20
- rack-cache (~> 1.1)
20
+ rack-cache (~> 1.2)
21
21
  rack-mount (~> 0.8.2)
22
22
  rack-test (~> 0.6.1)
23
- sprockets (~> 2.0.3)
24
- activemodel (3.1.4)
25
- activesupport (= 3.1.4)
23
+ sprockets (~> 2.0.4)
24
+ activemodel (3.1.5)
25
+ activesupport (= 3.1.5)
26
26
  builder (~> 3.0.0)
27
27
  i18n (~> 0.6)
28
- activerecord (3.1.4)
29
- activemodel (= 3.1.4)
30
- activesupport (= 3.1.4)
28
+ activerecord (3.1.5)
29
+ activemodel (= 3.1.5)
30
+ activesupport (= 3.1.5)
31
31
  arel (~> 2.2.3)
32
32
  tzinfo (~> 0.3.29)
33
33
  activerecord-import (0.2.9)
34
34
  activerecord (~> 3.0)
35
35
  activerecord (~> 3.0)
36
- activeresource (3.1.4)
37
- activemodel (= 3.1.4)
38
- activesupport (= 3.1.4)
39
- activesupport (3.1.4)
40
- multi_json (~> 1.0)
36
+ activeresource (3.1.5)
37
+ activemodel (= 3.1.5)
38
+ activesupport (= 3.1.5)
39
+ activesupport (3.1.5)
40
+ multi_json (>= 1.0, < 1.3)
41
41
  arel (2.2.3)
42
42
  bson (1.6.2)
43
43
  bson_ext (1.6.2)
@@ -53,7 +53,7 @@ GEM
53
53
  guard (>= 0.10.0)
54
54
  hike (1.2.1)
55
55
  i18n (0.6.0)
56
- json (1.7.1)
56
+ json (1.7.3)
57
57
  mail (2.3.3)
58
58
  i18n (>= 0.4.0)
59
59
  mime-types (~> 1.16)
@@ -61,11 +61,11 @@ GEM
61
61
  mime-types (1.18)
62
62
  mongo (1.6.2)
63
63
  bson (~> 1.6.2)
64
- mongoid (2.4.9)
64
+ mongoid (2.4.10)
65
65
  activemodel (~> 3.1)
66
66
  mongo (~> 1.3)
67
67
  tzinfo (~> 0.3.22)
68
- multi_json (1.3.4)
68
+ multi_json (1.2.0)
69
69
  mysql (2.8.1)
70
70
  perftools.rb (2.0.0)
71
71
  polyglot (0.3.3)
@@ -78,17 +78,17 @@ GEM
78
78
  rack
79
79
  rack-test (0.6.1)
80
80
  rack (>= 1.0)
81
- rails (3.1.4)
82
- actionmailer (= 3.1.4)
83
- actionpack (= 3.1.4)
84
- activerecord (= 3.1.4)
85
- activeresource (= 3.1.4)
86
- activesupport (= 3.1.4)
81
+ rails (3.1.5)
82
+ actionmailer (= 3.1.5)
83
+ actionpack (= 3.1.5)
84
+ activerecord (= 3.1.5)
85
+ activeresource (= 3.1.5)
86
+ activesupport (= 3.1.5)
87
87
  bundler (~> 1.0)
88
- railties (= 3.1.4)
89
- railties (3.1.4)
90
- actionpack (= 3.1.4)
91
- activesupport (= 3.1.4)
88
+ railties (= 3.1.5)
89
+ railties (3.1.5)
90
+ actionpack (= 3.1.5)
91
+ activesupport (= 3.1.5)
92
92
  rack-ssl (~> 1.3.2)
93
93
  rake (>= 0.8.7)
94
94
  rdoc (~> 3.4)
@@ -126,9 +126,9 @@ DEPENDENCIES
126
126
  bullet!
127
127
  guard
128
128
  guard-rspec
129
- mongoid
129
+ mongoid (= 2.4.10)
130
130
  mysql
131
131
  perftools.rb
132
- rails (= 3.1.4)
132
+ rails (= 3.1.5)
133
133
  rspec
134
134
  sqlite3
@@ -1,8 +1,10 @@
1
1
  module Bullet
2
2
  class ActionController
3
+ extend Dependency
4
+
3
5
  def self.enable
4
6
  require 'action_controller'
5
- if Rails.version =~ /\A2.3/
7
+ if active_record23?
6
8
  ::ActionController::Dispatcher.middleware.use Bullet::Rack
7
9
  ::ActionController::Dispatcher.class_eval do
8
10
  class <<self
@@ -13,7 +15,7 @@ module Bullet
13
15
  end
14
16
  end
15
17
  end
16
- elsif Rails.version =~ /\A2.[12]/
18
+ elsif active_record21? || active_record22?
17
19
  ::ActionController::Dispatcher.class_eval do
18
20
  alias_method :origin_reload_application, :reload_application
19
21
  def reload_application
@@ -29,8 +31,7 @@ module Bullet
29
31
  response = origin_process(request, response, method = :perform_action, *arguments)
30
32
 
31
33
  if Bullet.notification?
32
- if response.headers["type"] && response.headers["type"].include?('text/html') &&
33
- response.body.include?("<html>") && response.body.include?("</html>")
34
+ if response.headers["type"] && response.headers["type"].include?('text/html') && response.body.include?("<html>")
34
35
  response.body <<= Bullet.gather_inline_notifications
35
36
  response.headers["Content-Length"] = response.body.length.to_s
36
37
  end
@@ -0,0 +1,83 @@
1
+ module Bullet
2
+ module Dependency
3
+ def mongoid?
4
+ @mongoid ||= begin
5
+ require 'mongoid'
6
+ true
7
+ rescue LoadError
8
+ false
9
+ end
10
+ end
11
+
12
+ def active_record?
13
+ @active_record ||= begin
14
+ require 'active_record'
15
+ true
16
+ rescue LoadError
17
+ false
18
+ end
19
+ end
20
+
21
+ def active_record_version
22
+ @active_record_version ||= begin
23
+ if active_record2?
24
+ 'active_record2'
25
+ elsif active_record30?
26
+ 'active_record3'
27
+ elsif active_record31? || active_record32?
28
+ 'active_record31'
29
+ end
30
+ end
31
+ end
32
+
33
+ def mongoid_version
34
+ @mongoid_version ||= begin
35
+ if mongoid24?
36
+ 'mongoid24'
37
+ elsif mongoid3?
38
+ 'mongoid3'
39
+ end
40
+ end
41
+ end
42
+
43
+ def active_record2?
44
+ ::ActiveRecord::VERSION::MAJOR == 2
45
+ end
46
+
47
+ def active_record23?
48
+ active_record2? && ::ActiveRecord::VERSION::MINOR == 3
49
+ end
50
+
51
+ def active_record22?
52
+ active_record2? && ::ActiveRecord::VERSION::MINOR == 2
53
+ end
54
+
55
+ def active_record21?
56
+ active_record2? && ::ActiveRecord::VERSION::MINOR == 1
57
+ end
58
+
59
+ def active_record3?
60
+ ::ActiveRecord::VERSION::MAJOR == 3
61
+ end
62
+
63
+ def active_record30?
64
+ active_record3? && ::ActiveRecord::VERSION::MINOR == 0
65
+ end
66
+
67
+ def active_record31?
68
+ active_record3? && ::ActiveRecord::VERSION::MINOR == 1
69
+ end
70
+
71
+ def active_record32?
72
+ active_record3? && ::ActiveRecord::VERSION::MINOR == 2
73
+ end
74
+
75
+ def mongoid24?
76
+ ::Mongoid::VERSION =~ /\A2\.4/
77
+ end
78
+
79
+ def mongoid3?
80
+ ::Mongoid::VERSION =~ /\A3/
81
+ end
82
+ end
83
+ end
@@ -2,10 +2,12 @@ module Bullet
2
2
  module Mongoid
3
3
  def self.enable
4
4
  require 'mongoid'
5
+
5
6
  ::Mongoid::Contexts::Mongo.class_eval do
6
7
  alias_method :origin_first, :first
7
8
  alias_method :origin_last, :last
8
9
  alias_method :origin_iterate, :iterate
10
+ alias_method :origin_eager_load, :eager_load
9
11
 
10
12
  def first
11
13
  result = origin_first
@@ -28,19 +30,6 @@ module Bullet
28
30
  end
29
31
  origin_iterate(&block)
30
32
  end
31
- end
32
-
33
- ::Mongoid::Relations::Accessors.class_eval do
34
- alias_method :origin_set_relation, :set_relation
35
-
36
- def set_relation(name, relation)
37
- Bullet::Detector::NPlusOneQuery.call_association(self, name)
38
- origin_set_relation(name, relation)
39
- end
40
- end
41
-
42
- ::Mongoid::Contexts::Mongo.class_eval do
43
- alias_method :origin_eager_load, :eager_load
44
33
 
45
34
  def eager_load(docs)
46
35
  associations = criteria.inclusions.map(&:name)
@@ -51,6 +40,15 @@ module Bullet
51
40
  origin_eager_load(docs)
52
41
  end
53
42
  end
43
+
44
+ ::Mongoid::Relations::Accessors.class_eval do
45
+ alias_method :origin_set_relation, :set_relation
46
+
47
+ def set_relation(name, relation)
48
+ Bullet::Detector::NPlusOneQuery.call_association(self, name)
49
+ origin_set_relation(name, relation)
50
+ end
51
+ end
54
52
  end
55
53
  end
56
54
  end
@@ -0,0 +1,53 @@
1
+ module Bullet
2
+ module Mongoid
3
+ def self.enable
4
+ require 'mongoid'
5
+ ::Mongoid::Contextual::Mongo.class_eval do
6
+ alias_method :origin_first, :first
7
+ alias_method :origin_last, :last
8
+ alias_method :origin_each, :each
9
+ alias_method :origin_eager_load, :eager_load
10
+
11
+ def first
12
+ result = origin_first
13
+ Bullet::Detector::Association.add_impossible_object(result)
14
+ result
15
+ end
16
+
17
+ def last
18
+ result = origin_last
19
+ Bullet::Detector::Association.add_impossible_object(result)
20
+ result
21
+ end
22
+
23
+ def each(&block)
24
+ records = query.map{ |doc| ::Mongoid::Factory.from_db(klass, doc) }
25
+ if records.length > 1
26
+ Bullet::Detector::Association.add_possible_objects(records)
27
+ elsif records.size == 1
28
+ Bullet::Detector::Association.add_impossible_object(records.first)
29
+ end
30
+ origin_each(&block)
31
+ end
32
+
33
+ def eager_load(docs)
34
+ associations = criteria.inclusions.map(&:name)
35
+ docs.each do |doc|
36
+ Bullet::Detector::Association.add_object_associations(doc, associations)
37
+ end
38
+ Bullet::Detector::Association.add_eager_loadings(docs, associations)
39
+ origin_eager_load(docs)
40
+ end
41
+ end
42
+
43
+ ::Mongoid::Relations::Accessors.class_eval do
44
+ alias_method :origin_set_relation, :set_relation
45
+
46
+ def set_relation(name, relation)
47
+ Bullet::Detector::NPlusOneQuery.call_association(self, name)
48
+ origin_set_relation(name, relation)
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
data/lib/bullet/rack.rb CHANGED
@@ -9,7 +9,7 @@ module Bullet
9
9
 
10
10
  Bullet.start_request
11
11
  status, headers, response = @app.call(env)
12
- return [status, headers, response] if empty?(response)
12
+ return [status, headers, response] if file?(headers) || empty?(response)
13
13
 
14
14
  response_body = nil
15
15
  if Bullet.notification?
@@ -31,11 +31,13 @@ module Bullet
31
31
  !response.body.is_a?(String) || response.body.empty?
32
32
  end
33
33
 
34
+ # if send file?
35
+ def file?(headers)
36
+ headers["Content-Transfer-Encoding"] == "binary"
37
+ end
38
+
34
39
  def html_request?(headers, response)
35
- headers['Content-Type'] &&
36
- headers['Content-Type'].include?('text/html') &&
37
- response.body.include?("<html>") &&
38
- response.body.include?("</html>")
40
+ headers['Content-Type'] && headers['Content-Type'].include?('text/html') && response.body.include?("<html>")
39
41
  end
40
42
 
41
43
  def no_browser_cache(headers)
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
  module Bullet
3
- VERSION = "4.0.0"
3
+ VERSION = "4.1.1"
4
4
  end
5
5