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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9e1d258ec1612988eb818caa44674bb6d4f21b9a
4
- data.tar.gz: c2e11f00f01b18671a493d163d5d36a22b22a209
3
+ metadata.gz: 278b7b0c8e4eaa5a90b8f3c143cc6f08adbaf728
4
+ data.tar.gz: 4411c0c1be400d2453f866a278e4cca00af38f70
5
5
  SHA512:
6
- metadata.gz: 6c5011a422aeb7cf14294b9aa5a91e24aae5f76a4e0e8a1dca6ba06fc557775aa0b032d85f6629cd8f9d41725e77ed4b60737234984526dfb8aec1345cfb4278
7
- data.tar.gz: bb3272c536450a43b2838af7264c6f304fc7d9d9c7e67bd7f662c325d06a28140365b706165f7665475dc876ae6c8fe9dede01ac558f58086674796491b1d827
6
+ metadata.gz: 5aef6033d6aebdeb3055b33c3c4feda19d8fe1852337edfa9a6d2b78f4de1dd29c2fc9260dc2fab542f0c28b00f1bc6eef66334f0d75396c39a271325a29f108
7
+ data.tar.gz: d1948be82e4aa9496ab884dd5ef6e78e35afe8bc0542e7a38ad1d2c9175e7d773e70d9ca6763d410e6deb8f750559155f849d130bda1b16ebedd6115d65359f7
@@ -1,5 +1,4 @@
1
1
  rvm:
2
- - '1.9.3'
3
- - '2.0.0'
4
- - '2.1'
5
2
  - '2.2'
3
+ - '2.3'
4
+ - '2.4'
data/Gemfile CHANGED
@@ -2,3 +2,4 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in rurerurema.gemspec
4
4
  gemspec
5
+ gem 'byebug'
@@ -32,10 +32,11 @@ module Ruremai
32
32
  private
33
33
 
34
34
  def exist?(uri)
35
- Net::HTTP.start(uri.host, uri.port) {|http|
36
- response = http.head(uri.path)
35
+ http = Net::HTTP.new(uri.host, uri.port)
36
+ http.use_ssl = true
37
37
 
38
- case response
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.name : receiver.name
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 = 'http://doc.ruby-lang.org/ja/'
7
- major, minor, teeny = *RUBY_VERSION.split(".").map(&:to_i)
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
- uri_part = [PATH_VERSION_PART, 'method', escape(method_owner)].join('/')
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})
@@ -1,3 +1,3 @@
1
1
  module Ruremai
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
3
3
  end
@@ -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 = ['celluloid.key@gmail.com']
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.3'
18
+ gem.add_runtime_dependency 'launchy', '~> 2.4'
19
19
 
20
20
  gem.add_development_dependency 'rake'
21
- gem.add_development_dependency 'tapp', '~> 1.5.0'
22
- gem.add_development_dependency 'rspec', '~> 3.2.0'
21
+ gem.add_development_dependency 'rspec', '~> 3.6'
23
22
  end
@@ -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 %(http://doc.ruby-lang.org/ja/#{PATH_VERSION_PART}/method/Kernel/m/Integer.html) }
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 %(http://doc.ruby-lang.org/ja/#{PATH_VERSION_PART}/method/NilClass/i/nil=3f.html) }
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 %(http://doc.ruby-lang.org/ja/#{PATH_VERSION_PART}/method/Fixnum/i/=3c=3d=3e.html) }
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 %(http://doc.ruby-lang.org/ja/#{PATH_VERSION_PART}/method/Net=3a=3aHTTP/s/new.html) }
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 %(http://doc.ruby-lang.org/ja/#{PATH_VERSION_PART}/method/Kernel/m/=60.html) }
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 %(http://doc.ruby-lang.org/ja/#{PATH_VERSION_PART}/method/Fixnum/i/=2b.html) }
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 %(http://doc.ruby-lang.org/ja/#{PATH_VERSION_PART}/method/Numeric/i/=2b=40.html) }
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
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: 2015-06-01 00:00:00.000000000 Z
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.3
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.3
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.2.0
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.2.0
54
+ version: '3.6'
69
55
  description: Object.method(:name).rurema!
70
56
  email:
71
- - celluloid.key@gmail.com
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.4.5
97
+ rubygems_version: 2.6.11
112
98
  signing_key:
113
99
  specification_version: 4
114
100
  summary: Open ruby reference manual by browser.