cb_nitride 0.1.14 → 0.1.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cb_nitride/diamond_item.rb +6 -0
- data/lib/cb_nitride/title_formatter.rb +13 -5
- data/lib/cb_nitride/version.rb +1 -1
- data/test/unit/diamond_item_test.rb +0 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ef29e6b54fa90b0aee2c7dd154f87ad6136ea6f
|
4
|
+
data.tar.gz: 9eb6c981703dca995c8e546ef5101d83297559e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e73c79b2036496c82bd090d530265d523ff058f7845e1f2c0bafb5c47ef421569eb4ac4c7e1bf47101df9d9070fd928e4c9bb034612f29061a3bce2606da05d6
|
7
|
+
data.tar.gz: 5426d1eacf48a6064957371844e535ba4bcb7599af1de51eeaac38dc4df5b2f21ad810302b2762475edeb08c6c7bde3e10caa8d45b83f2465be9147382f89eb5
|
@@ -1,6 +1,8 @@
|
|
1
1
|
module CbNitride
|
2
2
|
class DiamondItem
|
3
3
|
|
4
|
+
SHORT_PAREN_OF_PATTERN = /\s*[O][f][(]/
|
5
|
+
|
4
6
|
attr_reader :state, :diamond_number, :stock_number, :image_url, :publisher, :creators, :description, :release_date, :price, :category_code, :errors, :raw_title, :image
|
5
7
|
|
6
8
|
def initialize(options = {})
|
@@ -105,6 +107,10 @@ module CbNitride
|
|
105
107
|
@_is_collection ||= CategorySorter::COLLECTION_CODE == category_code
|
106
108
|
end
|
107
109
|
|
110
|
+
def raw_title
|
111
|
+
@_raw_title ||= @raw_title.sub(SHORT_PAREN_OF_PATTERN, ' (Of ')
|
112
|
+
end
|
113
|
+
|
108
114
|
def is_merch?
|
109
115
|
@_is_merch ||= CategorySorter::MERCHANDISE_CODES.include? category_code
|
110
116
|
end
|
@@ -9,7 +9,7 @@ module CbNitride
|
|
9
9
|
@raw_title = raw_title
|
10
10
|
end
|
11
11
|
|
12
|
-
|
12
|
+
LONG_PAREN_OF_PATTERN = /[(].*[Oo][fF].*\d+.*[)]/
|
13
13
|
|
14
14
|
def series_title
|
15
15
|
@_series_title ||=
|
@@ -28,20 +28,28 @@ module CbNitride
|
|
28
28
|
|
29
29
|
def limited_series_max_issue
|
30
30
|
@_limited_series_max_issue ||=
|
31
|
-
|
32
|
-
|
31
|
+
if clean_title.match(LONG_PAREN_OF_PATTERN)
|
32
|
+
clean_long_paren_of_text
|
33
|
+
else
|
34
|
+
nil
|
35
|
+
end
|
33
36
|
end
|
34
37
|
|
35
38
|
def variant_description
|
36
39
|
@_variant_description ||=
|
37
40
|
array = clean_title.split(/#\S+/)
|
38
41
|
return nil if array.size == 1
|
39
|
-
string = array.last.gsub(
|
42
|
+
string = array.last.gsub(LONG_PAREN_OF_PATTERN, '').strip
|
40
43
|
string.empty? ? nil : string
|
41
44
|
end
|
42
45
|
|
46
|
+
def clean_long_paren_of_text
|
47
|
+
clean_title.match(LONG_PAREN_OF_PATTERN).to_s.match(/\d+/).to_s.strip.to_i
|
48
|
+
end
|
49
|
+
|
43
50
|
def clean_title
|
44
|
-
@_clean_title ||=
|
51
|
+
@_clean_title ||=
|
52
|
+
raw_title.gsub(/[(][C].*[)]?/, '').gsub('(MR)', '').gsub('(NET)', '').strip
|
45
53
|
end
|
46
54
|
|
47
55
|
end
|
data/lib/cb_nitride/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cb_nitride
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Jarvis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-11-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|