fortitude 0.9.2 → 0.9.3

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: 979ec914d2f256b806b70ad35fc10046423c6ebf
4
- data.tar.gz: 6d12dd12a458019abce25cb3d6d1fa7b8cdbabde
3
+ metadata.gz: 11cc27b7da627f35c70cfd102e2fcdfec18d0869
4
+ data.tar.gz: 05da4419831b8159503bf9da7f9e30074688774a
5
5
  SHA512:
6
- metadata.gz: c82032c67ec5e95e238b5914bc6b1fc8b6e14dc71aa90d81d47fd560e21e231059e097a0412e952acbc08142f5bdb05ae48655e6b3f8f8bc4223ce27ad5761e6
7
- data.tar.gz: 4b1af326ecd906612c06e4fe528f14135e4a845d87dec9c72308d5a061a78dd3bbf41226cee8a10a5e55ac04d45f2bd08920c298de21c0f7d8c7cfcb1d2790fb
6
+ metadata.gz: ab7eac05ec3e3fb020489fd7698c52dc77807c5a2078041439835cff4f5d44824fe2fa988a9ec7bfdbd1e730c20a60c392aaf8f6581fb19277f7f1d8fb1ca177
7
+ data.tar.gz: c51b8b6bb5e4f8208f27c254f0d039cc0dff46b2dfd3e35ca7ec674ccee6042b00921cf70416d539d0f1aaa5faf316651583777116a4cf375a7c4a706de061ca
data/CHANGES.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Fortitude Releases
2
2
 
3
+ ## 0.9.3, 2 February 2015
4
+
5
+ * Fixed a memory leak when using `render :inline`, or certain other cases triggered by a user. (Fortitude widget
6
+ classes know about all their subclasses, in order to enable proper propagation of configuration changes.
7
+ If you created a subclass of a Fortitude widget that was intended to be single-use or otherwise temporary, it would
8
+ not get garbage-collected, since its superclass would still maintain a reference to it. Fortitude now uses the
9
+ [ref](https://github.com/ruby-concurrency/ref) gem in order to make this a weak reference, hence allowing it to
10
+ be garbage-collected. `render :inline` creates a temporary subclass of a Fortitude widget, thus triggering exactly
11
+ this issue.)
12
+
3
13
  ## 0.9.2, 22 January 2015
4
14
 
5
15
  * Began writing lots of documentation for Fortitude, beginning with the reasons why you should use it.
data/CONTRIBUTORS.md CHANGED
@@ -32,6 +32,9 @@ Fortitude is written by [Andrew Geweke](https://github.com/ageweke), with contri
32
32
  * Reporting a bug where doing something like `div(nil, :class => 'foo')` would produce just `<div></div>` instead of
33
33
  the desired `<div class="foo"></div>`.
34
34
  * Reporting an issue where `return`ing from inside a block passed to a tag method would not render the closing tags.
35
+ * Reporting, and helping verify, an issue where creating anonymous subclasses of a Fortitude widget class (like
36
+ those used by `render :inline`) would cause those anonymous subclasses to never be garbage collected, causing
37
+ a memory leak.
35
38
  * [Adam Becker](https://github.com/ajb) for:
36
39
  * Discussion and details around exactly what `:attribute => true`, `:attribute => false`, and so on should render
37
40
  from Fortitude.
data/fortitude.gemspec CHANGED
@@ -32,6 +32,7 @@ Gem::Specification.new do |s|
32
32
  end
33
33
 
34
34
  s.add_dependency "activesupport", *activesupport_spec
35
+ s.add_dependency "ref", ">= 1.0.5"
35
36
 
36
37
  s.add_development_dependency "bundler", "~> 1.5"
37
38
  s.add_development_dependency "rake"
@@ -1,3 +1,3 @@
1
1
  module Fortitude
2
- VERSION = "0.9.2"
2
+ VERSION = "0.9.3"
3
3
  end
@@ -1,6 +1,8 @@
1
1
  require 'active_support'
2
2
  require 'active_support/concern'
3
3
 
4
+ require 'ref'
5
+
4
6
  require 'fortitude/tags/tags_module'
5
7
 
6
8
  module Fortitude
@@ -28,14 +30,17 @@ module Fortitude
28
30
 
29
31
  # INTERNAL USE ONLY
30
32
  def direct_subclasses
31
- @direct_subclasses || [ ]
33
+ @direct_subclasses ||= [ ]
34
+ @direct_subclasses.delete_if { |ref| (! ref.object) }
35
+ @direct_subclasses.map { |ref| ref.object }
32
36
  end
33
37
  private :direct_subclasses
34
38
 
35
39
  # INTERNAL USE ONLY -- RUBY CALLBACK
36
40
  def inherited(subclass)
37
- @direct_subclasses ||= [ ]
38
- @direct_subclasses |= [ subclass ]
41
+ unless direct_subclasses.detect { |sc| sc.equal?(subclass) }
42
+ @direct_subclasses << ::Ref::WeakReference.new(subclass)
43
+ end
39
44
  end
40
45
 
41
46
  # INTERNAL USE ONLY
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fortitude
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 0.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Geweke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-22 00:00:00.000000000 Z
11
+ date: 2015-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '3.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: ref
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 1.0.5
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 1.0.5
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: bundler
29
43
  requirement: !ruby/object:Gem::Requirement