method_match 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/method_match/matcher.rb +1 -1
- data/lib/method_match/name_extractor.rb +19 -0
- data/lib/method_match/version.rb +1 -1
- data/lib/method_match.rb +1 -0
- data/spec/method_match/name_extractor_spec.rb +21 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c43c7e1f446657a8fe84df85e1f76e946abc025b
|
4
|
+
data.tar.gz: 525d92aef7eac93fd4afacb2c246946eb899614a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e37c5969d398a782723cf3275ec20bb782d34b126b30e74a300261c06d5256cb81134607aa01e272f56ed463c06007cb52b16147784d168eaf20c6259162d56
|
7
|
+
data.tar.gz: 4c112a1acd85ad25b061f3f12f3ac02d064a9aee41aaea4fadfa625e189a7aba0551ffb8711d6bb8cae71b21dca07ee76c57c74121b36b6e0ceb78f628136290
|
data/lib/method_match/matcher.rb
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
module MethodMatch
|
2
|
+
class NameExtractor
|
3
|
+
attr_reader :name
|
4
|
+
|
5
|
+
def initialize name
|
6
|
+
@name = name
|
7
|
+
end
|
8
|
+
|
9
|
+
def name
|
10
|
+
p = pwd
|
11
|
+
return @name.sub "#{p}/", '' if @name.index( p ) == 0
|
12
|
+
@name
|
13
|
+
end
|
14
|
+
|
15
|
+
def pwd
|
16
|
+
`pwd`
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/method_match/version.rb
CHANGED
data/lib/method_match.rb
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), %w[.. spec_helper])
|
2
|
+
describe MethodMatch::NameExtractor do
|
3
|
+
let(:extractor) do
|
4
|
+
e = MethodMatch::NameExtractor.new filename
|
5
|
+
e.stub(:pwd) { '/home/name/project'}
|
6
|
+
e
|
7
|
+
end
|
8
|
+
|
9
|
+
describe '#name' do
|
10
|
+
subject { extractor.name }
|
11
|
+
context 'project dir' do
|
12
|
+
let(:filename) { '/home/name/project/file.rb'}
|
13
|
+
it { should eq( 'file.rb')}
|
14
|
+
end
|
15
|
+
|
16
|
+
context 'somwhere else' do
|
17
|
+
let(:filename) { '/home/othername/project/file.rb'}
|
18
|
+
it { should eq( '/home/othername/project/file.rb')}
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: method_match
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomasz Tokarski
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-04-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|
@@ -83,11 +83,13 @@ files:
|
|
83
83
|
- lib/method_match.rb
|
84
84
|
- lib/method_match/command_runner.rb
|
85
85
|
- lib/method_match/matcher.rb
|
86
|
+
- lib/method_match/name_extractor.rb
|
86
87
|
- lib/method_match/pry.rb
|
87
88
|
- lib/method_match/version.rb
|
88
89
|
- method_match.gemspec
|
89
90
|
- spec/method_match/command_runner_spec.rb
|
90
91
|
- spec/method_match/matcher_spec.rb
|
92
|
+
- spec/method_match/name_extractor_spec.rb
|
91
93
|
- spec/spec_helper.rb
|
92
94
|
homepage: http://tomasztokarski.com/method_match
|
93
95
|
licenses: []
|
@@ -116,5 +118,6 @@ summary: It runs specs for given file based on line number and file name. Suppos
|
|
116
118
|
test_files:
|
117
119
|
- spec/method_match/command_runner_spec.rb
|
118
120
|
- spec/method_match/matcher_spec.rb
|
121
|
+
- spec/method_match/name_extractor_spec.rb
|
119
122
|
- spec/spec_helper.rb
|
120
123
|
has_rdoc:
|