lcsort 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/lcsort.rb +23 -23
  3. data/lib/lcsort/version.rb +1 -1
  4. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 830c39b4588cbf4efdc6ce8eb0f97ad0ae596d77
4
- data.tar.gz: 760bb1182bdf2a660d364db668e64f0c80f4c88a
3
+ metadata.gz: df87391476a2e78eff938aa6599553f4dc278c78
4
+ data.tar.gz: 99b5ed3babdc1d7f4c5fe5ec827169c57b7d32d8
5
5
  SHA512:
6
- metadata.gz: 4bd2881d4c1c9f7ab8c7ead44801005e2c703acb4767d588633e271acad1f3f51233524ae3b793661c015861094513f02c483898f628e9874b02bce63c559678
7
- data.tar.gz: 955c2145684c114804e6e6a7b981ad48c240da3d49259eaeeda84004509845a1a71404b4b039d84783b7ff008653fdeea0db42af3df18af968fd15e4ec5c0ad9
6
+ metadata.gz: 8a834dd67dadc7d5d12e22745408d2a15eb6fb02097d04a0d1f3bc5aa0d74d7dd908f98a38b5bf8e3b2649d716f2123aa71a158c018401a566810ff58612c5e2
7
+ data.tar.gz: c3dc779121332d735296d1c5264c42e40aede8ca6610092dfea31a2963fd6870872a9570bae6bcdfaead78536295b058587425d79b24ebf4956f219da163cd0d
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  # The sorting code is organized as a class for code organization
4
- # and possible future parameterization.
4
+ # and possible future parameterization.
5
5
  #
6
6
  # Lcsort.new.normalize(call)
7
7
  #
@@ -43,7 +43,7 @@ class Lcsort
43
43
  (?: # optional doon2 -- date or other number eg 1991 , 103rd, 103d
44
44
  \.?
45
45
  (\d{1,4})
46
- (?:ST|ND|RD|TH|D)?
46
+ (?:ST|ND|RD|TH|D|Q)?
47
47
  )?
48
48
  \s*
49
49
  (?: # optional cutter
@@ -80,22 +80,22 @@ class Lcsort
80
80
  # cutter prefix separator must be lower ascii value than digit 0,
81
81
  # but higher than cutter_extralow_separator. `.` gives us
82
82
  # something that makes debugging easy and doesn't need to be
83
- # URI-escaped, which is nice.
83
+ # URI-escaped, which is nice.
84
84
  self.low_prefix_separator = '.'
85
85
  # cutter extralow separator separates cutter letter suffixes
86
86
  # ei as in the 'ab' A234ab. It must be LOWER ascii value than
87
- # low_prefix_separator to make sort work.
87
+ # low_prefix_separator to make sort work.
88
88
  # Could use space ` `, but `-` is
89
- # less confusing debugging and nice that it doesn't need to be URI-escaped.
89
+ # less confusing debugging and nice that it doesn't need to be URI-escaped.
90
90
  self.cutter_extralow_separator = '-'
91
91
 
92
92
  # Using anything less than ascii 0 should work, but `.` is nice for
93
- # debugging.
93
+ # debugging.
94
94
  self.class_letter_padding = '.'
95
95
 
96
96
  # Extra separator needs to be lower than our other separators,
97
- # especially cutter_extralow_separator.
98
- # Doubling the cutter_extralow_separator works.
97
+ # especially cutter_extralow_separator.
98
+ # Doubling the cutter_extralow_separator works.
99
99
  self.extra_separator = (self.cutter_extralow_separator * 2)
100
100
 
101
101
  # Needs to sort LOWER than extra separator, at least in cases
@@ -104,24 +104,24 @@ class Lcsort
104
104
  # three dashes.
105
105
  self.append_suffix_separator = (self.cutter_extralow_separator * 3)
106
106
 
107
- # Only state should be configuration, not about individual call numbers.
107
+ # Only state should be configuration, not about individual call numbers.
108
108
  # We re-use this for multiple call numbers, and don't want callnum-specific
109
109
  # state; we also want to ensure it's thread-safe for using between multiple
110
110
  # threads. So freeze it! Doesn't absolutely prevent state changes, but
111
- # helps and sends the message.
111
+ # helps and sends the message.
112
112
  self.freeze
113
113
  end
114
114
 
115
115
 
116
116
  # Our code is organized in a class, for code organization and
117
- # possibility of sub-class and constructor customization in the future.
117
+ # possibility of sub-class and constructor customization in the future.
118
118
  #
119
- # But most people will want to call as a simple class-method.
119
+ # But most people will want to call as a simple class-method.
120
120
  # Store a singleton instance of Lcsort to let class method
121
- # be efficient and not need to instantiate a new one every time.
121
+ # be efficient and not need to instantiate a new one every time.
122
122
  #
123
123
  # Initialize singleton NOT lazily but here on class def, for
124
- # thread safety.
124
+ # thread safety.
125
125
  @global = Lcsort.new
126
126
  def self.normalize(*args)
127
127
  @global.normalize(*args)
@@ -165,7 +165,7 @@ class Lcsort
165
165
 
166
166
  # Add cutters and doons in order, if present
167
167
  normal_str << normalize_doon(doon1) if doon1
168
-
168
+
169
169
  normal_str << normalize_cutter(c1alpha, c1num) if c1alpha
170
170
 
171
171
  normal_str << normalize_doon(doon2) if doon2
@@ -178,25 +178,25 @@ class Lcsort
178
178
  normal_str << normalize_append_suffix(options[:append_suffix]) if options[:append_suffix]
179
179
 
180
180
  # normally we REQUIRE an alpha and number for a good call number,
181
- # but for creating truncated_end_ranges, we relax that.
181
+ # but for creating truncated_end_ranges, we relax that.
182
182
  unless options[:range_end_construction]
183
183
  unless alpha && num
184
184
  return nil
185
185
  end
186
186
  end
187
187
 
188
- return normal_str
188
+ return normal_str
189
189
  end
190
190
 
191
191
  def truncated_range_end(callnum)
192
192
  # Tell normalize to relax it's restrictions for range_end
193
- # construction.
193
+ # construction.
194
194
  normalized = normalize(callnum, :range_end_construction => true)
195
195
 
196
196
  return nil unless normalized
197
197
 
198
198
  # We just add a HIGH_CHAR on the end to make sure this sorts
199
- # after the original normalized with ANYTHING else on the end.
199
+ # after the original normalized with ANYTHING else on the end.
200
200
  return normalized + HIGH_CHAR
201
201
  end
202
202
 
@@ -214,7 +214,7 @@ class Lcsort
214
214
  fill_spots = width - content.length
215
215
  fill_spots = 0 if fill_spots < 0
216
216
 
217
- return ('0' * fill_spots) + content
217
+ return ('0' * fill_spots) + content
218
218
  end
219
219
 
220
220
  def normalize_cutter(c_alpha_prefix, c_rest)
@@ -234,13 +234,13 @@ class Lcsort
234
234
  end
235
235
 
236
236
  # The 'extra' component is normalized by making it all alphanumeric,
237
- # and adding an ultra low prefix separator.
237
+ # and adding an ultra low prefix separator.
238
238
  def normalize_extra(extra)
239
239
  # Left-pad any volume/number type designations with zeros, so
240
240
  # they sort appropriately. We just find ALL numbers and
241
- # normalize them accordingly, it's good enough!
241
+ # normalize them accordingly, it's good enough!
242
242
  extra_normalized = extra.gsub(/(\d+)/) do |match|
243
- left_fill_number($1, self.extra_vol_num_width)
243
+ left_fill_number($1, self.extra_vol_num_width)
244
244
  end
245
245
 
246
246
  # remove all non-alphanumeric
@@ -1,3 +1,3 @@
1
1
  class Lcsort
2
- VERSION = "0.9.0"
2
+ VERSION = "0.9.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lcsort
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nikitas Tampakis
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2015-07-08 00:00:00.000000000 Z
12
+ date: 2018-09-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -92,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
92
92
  version: '0'
93
93
  requirements: []
94
94
  rubyforge_project:
95
- rubygems_version: 2.4.5
95
+ rubygems_version: 2.6.14.1
96
96
  signing_key:
97
97
  specification_version: 4
98
98
  summary: Sort-normalized forms of LC Call Numbers