bbs_2ch_url_validator 0.1.4 → 0.1.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: 5db179c5e56b3cc6205765c92d41432c4cd04c33
4
- data.tar.gz: 38981b1491d25439186bbcdfc109d022abfa578b
3
+ metadata.gz: d18763b2285ff5904ddb67711aba1eef017b36cc
4
+ data.tar.gz: 4a1129ca4aa6145b876954d8f913deb0b0274597
5
5
  SHA512:
6
- metadata.gz: 631d2a863cce82bbbe8f47f25fae4c23c2375d876f0b6412fc0612dd13293d190e725313f7c99c75cb953add487821d2d0ba306a2c13ddd04dc1c69f270926ee
7
- data.tar.gz: e2012bea3c9238a5154fb2c69cd21d252935381e89ca59d83cf0436d92afba4e66ae77a2b5c50620e6182d14455ee9e1c24b3bb587aa7934426c7666c3071958
6
+ metadata.gz: 4375d564eb3bbfc35d7d5b1bffdd3de60535ece7d7860ecf872da8cbe712160c17f053a9d64f2292c05a3d742e85b536b2e08c15fbce4fb437f3aeee8dede4df
7
+ data.tar.gz: 779266227124b65920d0cb1f3045ee0fc11503831dc6484dc77c79d9b72ff32ccf75c62e0b875bb03881847b89bab0937e8e3c2c70f2c208e1161142ac5d0c47
data/.gitignore CHANGED
@@ -105,3 +105,4 @@ Temporary Items
105
105
  .apdisk
106
106
 
107
107
 
108
+ .rspec
data/README.md CHANGED
@@ -45,6 +45,7 @@ The gem is available as open source under the terms of the [MIT License](http://
45
45
 
46
46
  ## History
47
47
 
48
+ - v0.1.5 Ignore res number(s) on URL (e.g.) http://toro.open2ch.net/test/read.cgi/tech/1371956681/l50
48
49
  - v0.1.4 Fix bugs of these: #dat?, #subject?, #setting?, #open? and override UrlInfo#to_s
49
50
  - v0.1.3 Add Bbs2chUrlValidator::URL#subject, #dat, #setting, #dat?, #subject?, #setting?, #open?
50
51
  - v0.1.2 Put #build_url into instance variable 'built_url'
@@ -2,8 +2,8 @@
2
2
  require_relative './bbs_2ch_url_validator/version'
3
3
 
4
4
  module Bbs2chUrlValidator
5
- # http://www.rubular.com/r/nFpFxFptsZ
6
- VALID_2CH_URL_REGEX = %r(^http:\/\/((?<server_name>.+)\.)?(?<is_open>open)?2ch.(?<tld>net|sc)\/?((test\/read\.cgi\/)?(?<board_name>\w+?)\/?((?<thread_key>\d{9,10})\/?)?)?((?<is_dat>dat)\/(?<thread_key2>\d{9,10})\.dat)?((?<is_subject>subject)\.txt)?((?<is_setting>SETTING)\.TXT)?$) # rubocop:disable Metrics/LineLength
5
+ # http://www.rubular.com/r/mxKUUaB6bg
6
+ VALID_2CH_URL_REGEX = %r(^http:\/\/((?<server_name>.+)\.)?(?<is_open>open)?2ch.(?<tld>net|sc)\/?((test\/read\.cgi\/)?(?<board_name>\w+?)\/?((?<thread_key>\d{9,10})(?:\/?(\d|l)*)?)?)?((?<is_dat>dat)\/(?<thread_key2>\d{9,10})\.dat)?((?<is_subject>subject)\.txt)?((?<is_setting>SETTING)\.TXT)?$) # rubocop:disable Metrics/LineLength
7
7
 
8
8
  class URL
9
9
  # @params [URI or String] url URL
@@ -58,7 +58,6 @@ module Bbs2chUrlValidator
58
58
  instance_variable_set("@#{k}", value)
59
59
  end
60
60
  @built_url = build_url
61
- define_methods
62
61
  end
63
62
 
64
63
  def dat
@@ -77,15 +76,15 @@ module Bbs2chUrlValidator
77
76
  built_url
78
77
  end
79
78
 
80
- private
79
+ def open?; @is_open end
81
80
 
82
- def define_methods
83
- %w(is_open is_dat is_subject is_setting).each do |attr|
84
- method_name = attr.gsub(/is_(.+)/) { "#{$1}?" }
85
- self.class.send(:define_method,
86
- method_name) { instance_variable_get("@#{attr}") }
87
- end
88
- end
81
+ def dat?; @is_dat end
82
+
83
+ def subject?; @is_subject end
84
+
85
+ def setting?; @is_setting end
86
+
87
+ private
89
88
 
90
89
  def build_url
91
90
  if @is_dat || @is_subject || @is_setting
@@ -1,3 +1,3 @@
1
1
  module Bbs2chUrlValidator
2
- VERSION = "0.1.4"
2
+ VERSION = '0.1.5'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bbs_2ch_url_validator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - dogwood008
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-09-05 00:00:00.000000000 Z
11
+ date: 2016-09-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler