mtrack 1.1.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/.travis.yml +1 -2
- data/Gemfile +5 -5
- data/Guardfile +7 -7
- data/README.md +3 -5
- data/Rakefile +1 -1
- data/lib/mtrack/mixin.rb +1 -3
- data/lib/mtrack/version.rb +1 -1
- data/mtrack.gemspec +15 -17
- data/spec/lib/mtrack/mixin_spec.rb +6 -6
- data/spec/lib/mtrack/state_spec.rb +4 -4
- data/tasks/console.rb +4 -12
- metadata +9 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7e65f515296198e42617b8a6310e5972b86fa5b
|
4
|
+
data.tar.gz: 70911119c9524b644cfe508c188ade1ed1c1190b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4b53ae6efa5206816f90afb16068cfd00a6e3e1bad8e08d170b02337f93291341673de1d7e1842325927ef81e6a7470c014afe46719736a4d46379286d00564
|
7
|
+
data.tar.gz: 010a939bdfb9e349a159765b78fa4612e36be6ed899d239de9dc472e84b1fb914be2a2ee7d8400420f6c8705d59ab7413348e1ca332636f32490a2f5b9134509
|
data/.rubocop.yml
CHANGED
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -3,16 +3,16 @@ gemspec
|
|
3
3
|
|
4
4
|
group :development do
|
5
5
|
gem "byebug", "~> 3.5.1"
|
6
|
-
gem "guard-rspec", "~> 4.
|
6
|
+
gem "guard-rspec", "~> 4.5.0"
|
7
7
|
gem "guard-rubocop", "~> 1.2.0"
|
8
|
-
gem "libnotify", "~> 0.
|
8
|
+
gem "libnotify", "~> 0.9.0"
|
9
9
|
gem "pry", "~> 0.10.1"
|
10
|
-
gem "rubocop", "~> 0.
|
10
|
+
gem "rubocop", "~> 0.28.0"
|
11
11
|
end
|
12
12
|
|
13
13
|
group :development, :test do
|
14
|
-
gem "codeclimate-test-reporter", "~> 0.4.
|
15
|
-
gem "rake", "~> 10.4.
|
14
|
+
gem "codeclimate-test-reporter", "~> 0.4.3"
|
15
|
+
gem "rake", "~> 10.4.2"
|
16
16
|
gem "rspec", "~> 3.1.0"
|
17
17
|
gem "simplecov", "~> 0.9.1"
|
18
18
|
end
|
data/Guardfile
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
guard :
|
2
|
-
watch(/^spec\/.+_spec\.rb$/)
|
3
|
-
watch(/^lib\/(.+)\.rb$/) {|m| "spec/lib/#{m[1]}_spec.rb" }
|
4
|
-
watch("spec/spec_helper.rb") { "spec" }
|
5
|
-
end
|
6
|
-
|
7
|
-
guard :rubocop do
|
1
|
+
guard :rubocop, all_on_start: false do
|
8
2
|
watch(/^.+\.rb$/)
|
9
3
|
watch(/^(?:.+\/)?\.rubocop\.yml$/) {|m| File.dirname(m[0]) }
|
10
4
|
watch(/^(?:.+\/)?.+\.gemspec$/)
|
11
5
|
watch(/^(?:.+\/)?(?:Gem|Rake)file$/)
|
12
6
|
end
|
7
|
+
|
8
|
+
guard :rspec, cmd: "bundle exec rspec -fd" do
|
9
|
+
watch(/^spec\/.+_spec\.rb$/)
|
10
|
+
watch(/^lib\/(.+)\.rb$/) {|m| "spec/lib/#{m[1]}_spec.rb" }
|
11
|
+
watch("spec/spec_helper.rb") { "spec" }
|
12
|
+
end
|
data/README.md
CHANGED
@@ -13,9 +13,8 @@
|
|
13
13
|
[gemnasium]: https://gemnasium.com/gdeoliveira/mtrack#development-dependencies
|
14
14
|
[inch-ci]: http://inch-ci.org/github/gdeoliveira/mtrack
|
15
15
|
|
16
|
-
MTrack extends the functionality of Modules and Classes and enables them to
|
17
|
-
|
18
|
-
through a hierarchy of inclusion and/or inheritance.
|
16
|
+
MTrack extends the functionality of Modules and Classes and enables them to define public methods within groups. These
|
17
|
+
methods can then be queried back even through a hierarchy of inclusion and/or inheritance.
|
19
18
|
|
20
19
|
## Installation
|
21
20
|
|
@@ -105,8 +104,7 @@ MySubClass.tracked_methods :integers #=> #<Set: {:one, :three, :two, :four}>
|
|
105
104
|
|
106
105
|
### Simple State Machine
|
107
106
|
|
108
|
-
We'll create a simple state machine using MTrack. First, let's create an
|
109
|
-
abstraction for the state machine.
|
107
|
+
We'll create a simple state machine using MTrack. First, let's create an abstraction for the state machine.
|
110
108
|
|
111
109
|
```ruby
|
112
110
|
require "mtrack"
|
data/Rakefile
CHANGED
data/lib/mtrack/mixin.rb
CHANGED
@@ -36,7 +36,7 @@ module MTrack
|
|
36
36
|
#
|
37
37
|
# Returns a set with the result.
|
38
38
|
def newly_defined_methods(mod, old_methods)
|
39
|
-
(mod.public_instance_methods(false) - old_methods).
|
39
|
+
(mod.public_instance_methods(false) - old_methods).to_set
|
40
40
|
end
|
41
41
|
|
42
42
|
##
|
@@ -76,8 +76,6 @@ module MTrack
|
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
79
|
-
public
|
80
|
-
|
81
79
|
##
|
82
80
|
# call-seq:
|
83
81
|
# tracked_methods(group_name = nil) => set
|
data/lib/mtrack/version.rb
CHANGED
data/mtrack.gemspec
CHANGED
@@ -4,22 +4,20 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require "mtrack/version"
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.
|
8
|
-
spec.
|
9
|
-
spec.
|
10
|
-
spec.
|
11
|
-
spec.
|
12
|
-
spec.
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
spec.
|
20
|
-
spec.
|
21
|
-
|
22
|
-
spec.files = `git ls-files -z`.split("\x0")
|
23
|
-
spec.test_files = spec.files.grep(/^(test|spec|features)\//)
|
7
|
+
spec.required_ruby_version = ">= 1.9"
|
8
|
+
spec.name = "mtrack"
|
9
|
+
spec.version = MTrack::VERSION
|
10
|
+
spec.authors = ["Gabriel de Oliveira"]
|
11
|
+
spec.email = ["deoliveira.gab@gmail.com"]
|
12
|
+
spec.summary = "Group and track methods on classes and modules."
|
13
|
+
spec.description = <<-EOS
|
14
|
+
MTrack extends the functionality of modules and classes and enables them to define public methods within groups. These
|
15
|
+
methods can then be queried back even through a hierarchy of inclusion and/or inheritance.
|
16
|
+
EOS
|
17
|
+
spec.homepage = "https://github.com/gdeoliveira/mtrack"
|
18
|
+
spec.license = "MIT"
|
19
|
+
spec.files = `git ls-files -z`.split("\x0")
|
20
|
+
spec.test_files = spec.files.grep(/^(test|spec|features)\//)
|
24
21
|
spec.require_paths = ["lib"]
|
22
|
+
spec.rdoc_options << "--title=MTrack"
|
25
23
|
end
|
@@ -6,9 +6,9 @@ describe MTrack::Mixin do
|
|
6
6
|
describe "#track_methods" do
|
7
7
|
it "is added after extending #{described_class}" do
|
8
8
|
mod = ::Module.new
|
9
|
-
expect(mod.private_methods
|
9
|
+
expect(mod.private_methods).not_to include(:track_methods)
|
10
10
|
mod.module_eval { extend MTrack::Mixin }
|
11
|
-
expect(mod.private_methods
|
11
|
+
expect(mod.private_methods).to include(:track_methods)
|
12
12
|
end
|
13
13
|
|
14
14
|
context "no block given" do
|
@@ -191,7 +191,7 @@ describe MTrack::Mixin do
|
|
191
191
|
end
|
192
192
|
|
193
193
|
it "has custom extensions as ancestors" do
|
194
|
-
expect(subject.singleton_methods
|
194
|
+
expect(subject.singleton_methods).to include(:base_extension_1_meth, :sub_extension_meth)
|
195
195
|
end
|
196
196
|
end
|
197
197
|
|
@@ -219,7 +219,7 @@ describe MTrack::Mixin do
|
|
219
219
|
end
|
220
220
|
|
221
221
|
it "has custom extensions as ancestors" do
|
222
|
-
expect(subject.singleton_methods
|
222
|
+
expect(subject.singleton_methods).to include(:base_extension_2_meth)
|
223
223
|
end
|
224
224
|
end
|
225
225
|
|
@@ -395,7 +395,7 @@ describe MTrack::Mixin do
|
|
395
395
|
end
|
396
396
|
end.to raise_error(RuntimeError, "Unexpected error")
|
397
397
|
|
398
|
-
expect(m.public_instance_methods(false)
|
398
|
+
expect(m.public_instance_methods(false)).to match_array([:meth_1, :meth_2])
|
399
399
|
expect(m.tracked_methods).to match_array([:meth_1, :meth_2])
|
400
400
|
end
|
401
401
|
end
|
@@ -415,7 +415,7 @@ describe MTrack::Mixin do
|
|
415
415
|
end
|
416
416
|
end.to raise_error(RuntimeError, "Unexpected error")
|
417
417
|
|
418
|
-
expect(c.public_instance_methods(false)
|
418
|
+
expect(c.public_instance_methods(false)).to match_array([:meth_1, :meth_2])
|
419
419
|
expect(c.tracked_methods).to match_array([:meth_1, :meth_2])
|
420
420
|
end
|
421
421
|
end
|
@@ -2,13 +2,13 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe MTrack::State do
|
4
4
|
let(:sample_group) do
|
5
|
-
{ :
|
6
|
-
:
|
5
|
+
{ con_1: { tracked: [:trk_1, :trk_2] },
|
6
|
+
con_2: { tracked: [:trk_2, :trk_3] }
|
7
7
|
}
|
8
8
|
end
|
9
9
|
let(:sample_group_2) do
|
10
|
-
{ :
|
11
|
-
:
|
10
|
+
{ con_2: { tracked: [:trk_3, :trk_4] },
|
11
|
+
con_3: { tracked: [:trk_4, :trk_5] }
|
12
12
|
}
|
13
13
|
end
|
14
14
|
|
data/tasks/console.rb
CHANGED
@@ -14,19 +14,11 @@ task :console do
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
require "pry"
|
20
|
-
rescue LoadError
|
21
|
-
require "irb"
|
22
|
-
end
|
23
|
-
else
|
24
|
-
require "irb"
|
25
|
-
end
|
26
|
-
|
27
|
-
if defined? Pry
|
17
|
+
begin
|
18
|
+
require "pry"
|
28
19
|
Pry.start
|
29
|
-
|
20
|
+
rescue LoadError
|
21
|
+
require "irb"
|
30
22
|
ARGV.clear
|
31
23
|
IRB.start
|
32
24
|
end
|
metadata
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mtrack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gabriel de Oliveira
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-19 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description:
|
14
|
-
to define public methods within groups. These
|
15
|
-
through a hierarchy of inclusion and/or inheritance.
|
13
|
+
description: |
|
14
|
+
MTrack extends the functionality of modules and classes and enables them to define public methods within groups. These
|
15
|
+
methods can then be queried back even through a hierarchy of inclusion and/or inheritance.
|
16
16
|
email:
|
17
17
|
- deoliveira.gab@gmail.com
|
18
18
|
executables: []
|
@@ -48,14 +48,15 @@ licenses:
|
|
48
48
|
- MIT
|
49
49
|
metadata: {}
|
50
50
|
post_install_message:
|
51
|
-
rdoc_options:
|
51
|
+
rdoc_options:
|
52
|
+
- "--title=MTrack"
|
52
53
|
require_paths:
|
53
54
|
- lib
|
54
55
|
required_ruby_version: !ruby/object:Gem::Requirement
|
55
56
|
requirements:
|
56
57
|
- - ">="
|
57
58
|
- !ruby/object:Gem::Version
|
58
|
-
version: '
|
59
|
+
version: '1.9'
|
59
60
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
60
61
|
requirements:
|
61
62
|
- - ">="
|
@@ -63,7 +64,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
63
64
|
version: '0'
|
64
65
|
requirements: []
|
65
66
|
rubyforge_project:
|
66
|
-
rubygems_version: 2.4.
|
67
|
+
rubygems_version: 2.4.5
|
67
68
|
signing_key:
|
68
69
|
specification_version: 4
|
69
70
|
summary: Group and track methods on classes and modules.
|