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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9f0e4d5a9f6a4cbbccdec3b2ebd3cc448eadf266
4
- data.tar.gz: a4b0b1a3f8bb13d0f61c4055db8071e0bfffcdef
3
+ metadata.gz: 4ef29e6b54fa90b0aee2c7dd154f87ad6136ea6f
4
+ data.tar.gz: 9eb6c981703dca995c8e546ef5101d83297559e9
5
5
  SHA512:
6
- metadata.gz: c82f8e8b54592fdb1db104342d683ba8d274b08b8e14e7f4d28ad55ef44b77ef688b00aab22fbbdbd5c0b84f019f58f22505dd96837b7189bb11173eaeeb3f29
7
- data.tar.gz: dc7578aa27001e5b74837d3afb25f3d356ab17c9acca8f75c076740d9c919fc5583456d2aabcf1c7ac8e86b8ac5d455c731d7e729634dfc528f945a85e0b7308
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
- OF_PATTERN = /[(].*[Oo][fF].*\d+.*[)]/
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
- num = clean_title.match(OF_PATTERN).to_s.match(/\d+/).to_s.strip
32
- num.empty? ? nil : num.to_i
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(OF_PATTERN, '').strip
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 ||= raw_title.gsub(/[(][C].*[)]?/, '').gsub('(MR)', '').gsub('(NET)', '').strip
51
+ @_clean_title ||=
52
+ raw_title.gsub(/[(][C].*[)]?/, '').gsub('(MR)', '').gsub('(NET)', '').strip
45
53
  end
46
54
 
47
55
  end
@@ -1,3 +1,3 @@
1
1
  module CbNitride
2
- VERSION = "0.1.14"
2
+ VERSION = "0.1.15"
3
3
  end
@@ -37,6 +37,4 @@ class DiamondItemTest < MiniTest::Unit::TestCase
37
37
  assert_equal :merchandise, ideal_merchandise
38
38
  end
39
39
 
40
- #TODO Test for Correct Creator filtering, consider moving ideal objects to module
41
-
42
40
  end
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.14
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-09-03 00:00:00.000000000 Z
11
+ date: 2013-11-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler