ruremai 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -3
- data/Gemfile +1 -0
- data/lib/ruremai/locator.rb +5 -4
- data/lib/ruremai/locator/rurema.rb +10 -12
- data/lib/ruremai/version.rb +1 -1
- data/ruremai.gemspec +3 -4
- data/spec/locator/rurema_spec.rb +19 -7
- metadata +8 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 278b7b0c8e4eaa5a90b8f3c143cc6f08adbaf728
|
4
|
+
data.tar.gz: 4411c0c1be400d2453f866a278e4cca00af38f70
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5aef6033d6aebdeb3055b33c3c4feda19d8fe1852337edfa9a6d2b78f4de1dd29c2fc9260dc2fab542f0c28b00f1bc6eef66334f0d75396c39a271325a29f108
|
7
|
+
data.tar.gz: d1948be82e4aa9496ab884dd5ef6e78e35afe8bc0542e7a38ad1d2c9175e7d773e70d9ca6763d410e6deb8f750559155f849d130bda1b16ebedd6115d65359f7
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/lib/ruremai/locator.rb
CHANGED
@@ -32,10 +32,11 @@ module Ruremai
|
|
32
32
|
private
|
33
33
|
|
34
34
|
def exist?(uri)
|
35
|
-
Net::HTTP.
|
36
|
-
|
35
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
36
|
+
http.use_ssl = true
|
37
37
|
|
38
|
-
|
38
|
+
http.start {|h|
|
39
|
+
case h.head(uri.path)
|
39
40
|
when Net::HTTPSuccess, Net::HTTPRedirection
|
40
41
|
true
|
41
42
|
else
|
@@ -46,7 +47,7 @@ module Ruremai
|
|
46
47
|
|
47
48
|
# XXX can't care singleton method
|
48
49
|
def method_owner
|
49
|
-
owner.name ? owner
|
50
|
+
owner.name ? owner : receiver
|
50
51
|
end
|
51
52
|
end
|
52
53
|
end
|
@@ -3,29 +3,27 @@ require 'cgi'
|
|
3
3
|
module Ruremai
|
4
4
|
module Locator
|
5
5
|
class Rurema < Base
|
6
|
-
URI_BASE = '
|
7
|
-
major, minor, teeny = *RUBY_VERSION.split(
|
6
|
+
URI_BASE = 'https://docs.ruby-lang.org/ja/'
|
7
|
+
major, minor, teeny = *RUBY_VERSION.split('.').map(&:to_i)
|
8
8
|
PATH_VERSION_PART = [major, minor, major >= 2 ? 0 : teeny].join(".")
|
9
9
|
|
10
10
|
def candidates
|
11
|
-
|
11
|
+
method_owner.ancestors.inject([]) {|all, mod| all + candidates_for(mod) }
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def candidates_for(mod)
|
17
|
+
uri_part = [PATH_VERSION_PART, 'method', escape(mod.name)].join('/')
|
12
18
|
method_name = escape(name.to_s)
|
13
19
|
|
14
20
|
# s: singleton mehtod, m: module function, i: instance method
|
15
|
-
ordered_types =
|
16
|
-
if receiver.is_a?(Module)
|
17
|
-
%w(s m i)
|
18
|
-
else
|
19
|
-
%w(i m s)
|
20
|
-
end
|
21
|
-
|
21
|
+
ordered_types = receiver.is_a?(Module) ? %w(s m i) : %w(i m s)
|
22
22
|
ordered_types.map {|type|
|
23
23
|
URI.parse("#{URI_BASE}#{uri_part}/#{type}/#{method_name}.html")
|
24
24
|
}
|
25
25
|
end
|
26
26
|
|
27
|
-
private
|
28
|
-
|
29
27
|
def escape(str)
|
30
28
|
CGI.escape(str).gsub(/(%[\dA-Z]{2})/) {|s|
|
31
29
|
%(=#{s[1..-1].downcase})
|
data/lib/ruremai/version.rb
CHANGED
data/ruremai.gemspec
CHANGED
@@ -3,7 +3,7 @@ require File.expand_path('../lib/ruremai/version', __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
5
|
gem.authors = ['hibariya']
|
6
|
-
gem.email = ['
|
6
|
+
gem.email = ['hibariya@gmail.com']
|
7
7
|
gem.description = %q{Object.method(:name).rurema!}
|
8
8
|
gem.summary = %q{Open ruby reference manual by browser.}
|
9
9
|
gem.homepage = 'https://github.com/hibariya/ruremai'
|
@@ -15,9 +15,8 @@ Gem::Specification.new do |gem|
|
|
15
15
|
gem.require_paths = ['lib']
|
16
16
|
gem.version = Ruremai::VERSION
|
17
17
|
|
18
|
-
gem.add_runtime_dependency 'launchy', '~> 2.4
|
18
|
+
gem.add_runtime_dependency 'launchy', '~> 2.4'
|
19
19
|
|
20
20
|
gem.add_development_dependency 'rake'
|
21
|
-
gem.add_development_dependency '
|
22
|
-
gem.add_development_dependency 'rspec', '~> 3.2.0'
|
21
|
+
gem.add_development_dependency 'rspec', '~> 3.6'
|
23
22
|
end
|
data/spec/locator/rurema_spec.rb
CHANGED
@@ -10,43 +10,55 @@ describe Ruremai::Locator::Rurema do
|
|
10
10
|
describe 'CamelCase method' do
|
11
11
|
let(:target) { method(:Integer) }
|
12
12
|
|
13
|
-
it { should include %(
|
13
|
+
it { should include %(https://docs.ruby-lang.org/ja/#{PATH_VERSION_PART}/method/Kernel/m/Integer.html) }
|
14
14
|
end
|
15
15
|
|
16
16
|
describe 'query method' do
|
17
17
|
let(:target) { nil.method(:nil?) }
|
18
18
|
|
19
|
-
it { should include %(
|
19
|
+
it { should include %(https://docs.ruby-lang.org/ja/#{PATH_VERSION_PART}/method/NilClass/i/nil=3f.html) }
|
20
20
|
end
|
21
21
|
|
22
22
|
describe 'space ship operator' do
|
23
23
|
let(:target) { 0.method(:<=>) }
|
24
24
|
|
25
|
-
it { should include %(
|
25
|
+
it { should include %(https://docs.ruby-lang.org/ja/#{PATH_VERSION_PART}/method/Integer/i/=3c=3d=3e.html) }
|
26
26
|
end
|
27
27
|
|
28
28
|
describe 'nested class' do
|
29
29
|
let(:target) { Net::HTTP.method(:new) }
|
30
30
|
|
31
|
-
it { should include %(
|
31
|
+
it { should include %(https://docs.ruby-lang.org/ja/#{PATH_VERSION_PART}/method/Net=3a=3aHTTP/s/new.html) }
|
32
32
|
end
|
33
33
|
|
34
34
|
describe '`' do
|
35
35
|
let(:target) { Kernel.method(:`) }
|
36
36
|
|
37
|
-
it { should include %(
|
37
|
+
it { should include %(https://docs.ruby-lang.org/ja/#{PATH_VERSION_PART}/method/Kernel/m/=60.html) }
|
38
38
|
end
|
39
39
|
|
40
40
|
describe 'infix operator method' do
|
41
41
|
let(:target) { 1.method(:+) }
|
42
42
|
|
43
|
-
it { should include %(
|
43
|
+
it { should include %(https://docs.ruby-lang.org/ja/#{PATH_VERSION_PART}/method/Integer/i/=2b.html) }
|
44
44
|
end
|
45
45
|
|
46
46
|
describe 'prefix operator method' do
|
47
47
|
let(:target) { 1.method(:+@) }
|
48
48
|
|
49
|
-
it { should include %(
|
49
|
+
it { should include %(https://docs.ruby-lang.org/ja/#{PATH_VERSION_PART}/method/Numeric/i/=2b=40.html) }
|
50
|
+
end
|
51
|
+
|
52
|
+
describe 'prefix operator method' do
|
53
|
+
let(:target) { 1.method(:+@) }
|
54
|
+
|
55
|
+
it { should include %(https://docs.ruby-lang.org/ja/#{PATH_VERSION_PART}/method/Numeric/i/=2b=40.html) }
|
56
|
+
end
|
57
|
+
|
58
|
+
describe 'retrieve ancestors' do
|
59
|
+
let(:target) { [].method(:map) }
|
60
|
+
|
61
|
+
it { should include %(https://docs.ruby-lang.org/ja/#{PATH_VERSION_PART}/method/Enumerable/i/map.html) }
|
50
62
|
end
|
51
63
|
end
|
52
64
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruremai
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- hibariya
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-08-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: launchy
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.4
|
19
|
+
version: '2.4'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.4
|
26
|
+
version: '2.4'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,37 +38,23 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: tapp
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: 1.5.0
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: 1.5.0
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
42
|
name: rspec
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
58
44
|
requirements:
|
59
45
|
- - "~>"
|
60
46
|
- !ruby/object:Gem::Version
|
61
|
-
version: 3.
|
47
|
+
version: '3.6'
|
62
48
|
type: :development
|
63
49
|
prerelease: false
|
64
50
|
version_requirements: !ruby/object:Gem::Requirement
|
65
51
|
requirements:
|
66
52
|
- - "~>"
|
67
53
|
- !ruby/object:Gem::Version
|
68
|
-
version: 3.
|
54
|
+
version: '3.6'
|
69
55
|
description: Object.method(:name).rurema!
|
70
56
|
email:
|
71
|
-
-
|
57
|
+
- hibariya@gmail.com
|
72
58
|
executables: []
|
73
59
|
extensions: []
|
74
60
|
extra_rdoc_files: []
|
@@ -108,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
94
|
version: '0'
|
109
95
|
requirements: []
|
110
96
|
rubyforge_project:
|
111
|
-
rubygems_version: 2.
|
97
|
+
rubygems_version: 2.6.11
|
112
98
|
signing_key:
|
113
99
|
specification_version: 4
|
114
100
|
summary: Open ruby reference manual by browser.
|