allocation_stats 0.1.1 → 0.1.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.
- checksums.yaml +4 -4
- data/CHANGELOG.markdown +12 -0
- data/README.markdown +9 -8
- data/allocation_stats.gemspec +2 -1
- data/lib/allocation_stats/allocation.rb +2 -0
- data/lib/allocation_stats/allocations_proxy.rb +8 -1
- metadata +11 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 58815fef555e954a433a92b7cef4eddd6858569a
|
4
|
+
data.tar.gz: 6607ada6920ec63153e39418023e77d216eca304
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d4da2e5ad7dc0257b91124fbd506e58dece431047d9e73aee0f20d251c1a462477b1cba0a44c483122be048b2d8b5826d67e83acdf2802174f22e576e622591
|
7
|
+
data.tar.gz: 52e28c0ba9065822aef3bc575c00c39e1096603b26b610b6df5b912e70e5edd5e17db72bc88c4591f7df9e226201052b2fd42d775ead90ad30ca8c08286384ce
|
data/CHANGELOG.markdown
ADDED
data/README.markdown
CHANGED
@@ -203,14 +203,15 @@ line to see how we can pull useful information out:
|
|
203
203
|
```
|
204
204
|
|
205
205
|
If you are used to chaining ActiveRecord relations, some of this might look
|
206
|
-
familiar to you: `stats.allocations` will hand you back an
|
207
|
-
object, designed to hold the various
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
(aliased to `#all`, just
|
206
|
+
familiar to you: `stats.allocations` will hand you back an
|
207
|
+
{AllocationStats::AllocationsProxy} object, designed to hold the various
|
208
|
+
transformations that you wish to run the allocations through. AllocationsProxy
|
209
|
+
uses the Command pattern to store up transformations before they will actually
|
210
|
+
be applied. In this example, we only make one transformation:
|
211
|
+
`group_by(:@sourcefile, :class)`. This method just returns the same
|
212
|
+
AllocationsProxy object back, so that transformations can be chained. The final
|
213
|
+
call that will execute the transformations is `#to_a` (aliased to `#all`, just
|
214
|
+
like ActiveRecord).
|
214
215
|
|
215
216
|
Psych Example
|
216
217
|
-------------
|
data/allocation_stats.gemspec
CHANGED
@@ -3,9 +3,10 @@
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |spec|
|
5
5
|
spec.name = "allocation_stats"
|
6
|
-
spec.version = "0.1.
|
6
|
+
spec.version = "0.1.2"
|
7
7
|
spec.authors = ["Sam Rawlins"]
|
8
8
|
spec.email = ["sam.rawlins@gmail.com"]
|
9
|
+
spec.homepage = "https://github.com/srawlins/allocation_stats"
|
9
10
|
spec.license = "Apache v2"
|
10
11
|
spec.summary = "Tooling for tracing object allocations in Ruby 2.1"
|
11
12
|
spec.description = "Tooling for tracing object allocations in Ruby 2.1"
|
@@ -50,6 +50,8 @@ class AllocationStats
|
|
50
50
|
@alias_paths = alias_paths
|
51
51
|
end
|
52
52
|
|
53
|
+
# Apply all transformations to the contained list of Allocations. This is
|
54
|
+
# aliased as `:all`.
|
53
55
|
def to_a
|
54
56
|
results = @allocations
|
55
57
|
|
@@ -69,6 +71,9 @@ class AllocationStats
|
|
69
71
|
end
|
70
72
|
alias :all :to_a
|
71
73
|
|
74
|
+
# If a value is passed in, @alias_paths will be set to this value, and the
|
75
|
+
# AllocationStats object will be returned. If no value is passed in, this
|
76
|
+
# will return the @alias_paths.
|
72
77
|
def alias_paths(value = nil)
|
73
78
|
# reader
|
74
79
|
return @alias_paths if value.nil?
|
@@ -178,7 +183,8 @@ class AllocationStats
|
|
178
183
|
end
|
179
184
|
private :attribute_getters
|
180
185
|
|
181
|
-
# Map to bytes via {Allocation#memsize #memsize}. This is done in one of
|
186
|
+
# Map to bytes via {Allocation#memsize #memsize}. This is done in one of
|
187
|
+
# two ways:
|
182
188
|
#
|
183
189
|
# * If the current result set is an Array, then this transform just maps
|
184
190
|
# each Allocation to its `#memsize`.
|
@@ -226,6 +232,7 @@ class AllocationStats
|
|
226
232
|
end
|
227
233
|
end
|
228
234
|
|
235
|
+
# Resolve all transformations, and convert the resultant Array to JSON.
|
229
236
|
def to_json
|
230
237
|
to_a.to_json
|
231
238
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: allocation_stats
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Rawlins
|
@@ -14,14 +14,14 @@ dependencies:
|
|
14
14
|
name: rspec
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
description: Tooling for tracing object allocations in Ruby 2.1
|
@@ -31,8 +31,9 @@ executables: []
|
|
31
31
|
extensions: []
|
32
32
|
extra_rdoc_files: []
|
33
33
|
files:
|
34
|
-
- .gitignore
|
35
|
-
- .yardopts
|
34
|
+
- ".gitignore"
|
35
|
+
- ".yardopts"
|
36
|
+
- CHANGELOG.markdown
|
36
37
|
- Gemfile
|
37
38
|
- Gemfile.lock
|
38
39
|
- LICENSE
|
@@ -53,7 +54,7 @@ files:
|
|
53
54
|
- spec/allocation_stats/allocations_proxy_spec.rb
|
54
55
|
- spec/allocation_stats_spec.rb
|
55
56
|
- spec/spec_helper.rb
|
56
|
-
homepage:
|
57
|
+
homepage: https://github.com/srawlins/allocation_stats
|
57
58
|
licenses:
|
58
59
|
- Apache v2
|
59
60
|
metadata: {}
|
@@ -63,18 +64,19 @@ require_paths:
|
|
63
64
|
- lib
|
64
65
|
required_ruby_version: !ruby/object:Gem::Requirement
|
65
66
|
requirements:
|
66
|
-
- -
|
67
|
+
- - ">"
|
67
68
|
- !ruby/object:Gem::Version
|
68
69
|
version: 2.0.99
|
69
70
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
71
|
requirements:
|
71
|
-
- -
|
72
|
+
- - ">="
|
72
73
|
- !ruby/object:Gem::Version
|
73
74
|
version: '0'
|
74
75
|
requirements: []
|
75
76
|
rubyforge_project:
|
76
|
-
rubygems_version: 2.0.
|
77
|
+
rubygems_version: 2.2.0.preview.1
|
77
78
|
signing_key:
|
78
79
|
specification_version: 4
|
79
80
|
summary: Tooling for tracing object allocations in Ruby 2.1
|
80
81
|
test_files: []
|
82
|
+
has_rdoc:
|