naturally 1.3.0 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e7f13718d03ab6f2f6e7d7fc6f3aa44683aa14ac
4
- data.tar.gz: d0576fae7b11c7a543fb9a78d06a74805ee171ac
3
+ metadata.gz: a36e33ade747d0c59b3788ba0bb22c1f6defb184
4
+ data.tar.gz: a81707fb161b155dc47bed22462cf8a9ed734fe5
5
5
  SHA512:
6
- metadata.gz: b8dd2bf1648705cf27085b9e67900def932a3d470577dcaeee866c2a0e8461cc5aef5e26d57d8f43b1e262ac125603d6a32c1f135f26bca22d708a303d9262b3
7
- data.tar.gz: ac2984cf0e59d68ec9c27a3b73a29e066c8f90e48749c5b67661b201a878758904f96087a21a8ae7987560184fb78793b2ea568c34e8c6ce7eb44e9132637d42
6
+ metadata.gz: 7536fef931a0c593bc9918bff1e6407922a18cc339f8e0d96edf8e97db941232809238749fe6fd65f9fb9264cd8fa89d16d01cef8e64afe30301def32f6726f3
7
+ data.tar.gz: 00f5d433456e0516da7229ab2c64b9c5bbb448aa556e58252115a564d431078dfe19ca8fa1d28b5fd6cfaeee89e3e600db59f3c27d67f9f94e58fb5995a45888
data/.gitignore CHANGED
@@ -17,3 +17,4 @@ Gemfile.lock
17
17
  .yardoc
18
18
  _yardoc
19
19
  doc/
20
+ .idea/
data/README.md CHANGED
@@ -1,12 +1,10 @@
1
1
  # Naturally
2
2
  [![Gem Version](https://badge.fury.io/rb/naturally.png)](http://badge.fury.io/rb/naturally) [![Build Status](https://travis-ci.org/dogweather/naturally.png)](https://travis-ci.org/dogweather/naturally) [![Code Climate](https://codeclimate.com/github/dogweather/naturally.png)](https://codeclimate.com/github/dogweather/naturally)
3
3
 
4
- Natural (version number) sorting with added support for legal document numbering.
5
- See Jeff Atwood's [Sorting for Humans: Natural Sort Order](http://www.codinghorror.com/blog/2007/12/sorting-for-humans-natural-sort-order.html) and the Weblaws.org post [Counting to 10 in Californian](http://www.weblaws.org/blog/2012/08/counting-from-1-to-10-in-californian/)
6
- for the motivations to make this library.
4
+ Natural (version number) sorting with added support for **legal document numbering** and **Unicode**.
5
+ See Jeff Atwood's [Sorting for Humans: Natural Sort Order](http://www.codinghorror.com/blog/2007/12/sorting-for-humans-natural-sort-order.html) and the Weblaws.org post [Counting to 10 in Californian](http://www.weblaws.org/blog/2012/08/counting-from-1-to-10-in-californian/).
7
6
 
8
- The core of the search is [from here](https://github.com/ahoward/version_sorter). I then made
9
- several changes to handle the particular types of numbers that come up in statutes, such
7
+ The core of the search is [from here](https://github.com/ahoward/version_sorter). It's since been extended to handle the particular types of numbers that come up in statutes, such
10
8
  as *335.1, 336, 336a*, etc.
11
9
 
12
10
  `Naturally` will also sort "numbers" in college course code format such as
@@ -41,35 +39,31 @@ Usually the library is used to sort an array of objects:
41
39
 
42
40
 
43
41
  ```Ruby
44
- describe '#sort_naturally_by' do
45
- it 'sorts by an attribute' do
46
- # Define a new simple object for storing Ubuntu versions
47
- UbuntuVersion = Struct.new(:name, :version)
48
-
49
- # Create an array
50
- releases = [
51
- UbuntuVersion.new('Saucy Salamander', '13.10'),
52
- UbuntuVersion.new('Raring Ringtail', '13.04'),
53
- UbuntuVersion.new('Precise Pangolin', '12.04.4'),
54
- UbuntuVersion.new('Maverick Meerkat', '10.10'),
55
- UbuntuVersion.new('Quantal Quetzal', '12.10'),
56
- UbuntuVersion.new('Lucid Lynx', '10.04.4')
57
- ]
58
-
59
- # Sort by version number
60
- sorted = Naturally.sort_by(releases, :version)
61
-
62
- # Check what we have
63
- expect(sorted.map(&:name)).to eq [
64
- 'Lucid Lynx',
65
- 'Maverick Meerkat',
66
- 'Precise Pangolin',
67
- 'Quantal Quetzal',
68
- 'Raring Ringtail',
69
- 'Saucy Salamander'
70
- ]
71
- end
72
- end
42
+ # Define a new simple object for storing Ubuntu versions
43
+ UbuntuVersion = Struct.new(:name, :version)
44
+
45
+ # Create an array
46
+ releases = [
47
+ UbuntuVersion.new('Saucy Salamander', '13.10'),
48
+ UbuntuVersion.new('Raring Ringtail', '13.04'),
49
+ UbuntuVersion.new('Precise Pangolin', '12.04.4'),
50
+ UbuntuVersion.new('Maverick Meerkat', '10.10'),
51
+ UbuntuVersion.new('Quantal Quetzal', '12.10'),
52
+ UbuntuVersion.new('Lucid Lynx', '10.04.4')
53
+ ]
54
+
55
+ # Sort by version number
56
+ sorted = Naturally.sort_by(releases, :version)
57
+
58
+ # Check what we have
59
+ expect(sorted.map(&:name)).to eq [
60
+ 'Lucid Lynx',
61
+ 'Maverick Meerkat',
62
+ 'Precise Pangolin',
63
+ 'Quantal Quetzal',
64
+ 'Raring Ringtail',
65
+ 'Saucy Salamander'
66
+ ]
73
67
  ```
74
68
 
75
69
  See [the spec for more examples](https://github.com/dogweather/naturally/blob/master/spec/naturally_spec.rb) of what Naturally can sort.
data/Rakefile CHANGED
@@ -1,5 +1,4 @@
1
1
  require "bundler/gem_tasks"
2
-
3
2
  require 'rspec/core/rake_task'
4
3
 
5
4
  RSpec::Core::RakeTask.new('spec')
@@ -1,3 +1,3 @@
1
1
  module Naturally
2
- VERSION = '1.3.0'
2
+ VERSION = '1.3.1'
3
3
  end
@@ -9,7 +9,7 @@ describe Naturally do
9
9
  b = %w[676 676.1 676.2 676.3 676.9 676.10 676.11 676.12]
10
10
  Naturally.sort(a).should == b
11
11
  end
12
-
12
+
13
13
  it 'sorts a more complex list of strings' do
14
14
  a = %w[350 351 352 352.1 352.5 353.1 354 354.3 354.4 354.45 354.5]
15
15
  b = %w[350 351 352 352.1 352.5 353.1 354 354.3 354.4 354.5 354.45]
@@ -52,7 +52,7 @@ describe Naturally do
52
52
  Naturally.sort(a).should == b
53
53
  end
54
54
  end
55
-
55
+
56
56
  describe '#sort_naturally_by' do
57
57
  it 'sorts by an attribute' do
58
58
  UbuntuVersion = Struct.new(:name, :version)
@@ -75,7 +75,7 @@ describe Naturally do
75
75
  ]
76
76
  end
77
77
 
78
- it 'sorts by an attribute which contains unicode characters' do
78
+ it 'sorts by an attribute which contains unicode' do
79
79
  Thing = Struct.new(:number, :name)
80
80
  objects = [
81
81
  Thing.new('1.1', 'Москва'),
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: naturally
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robb Shecter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-28 00:00:00.000000000 Z
11
+ date: 2014-05-07 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Natural Sorting with support for legal numbering
14
14
  email:
@@ -52,3 +52,4 @@ specification_version: 4
52
52
  summary: Sorts numbers according to the way people are used to seeing them.
53
53
  test_files:
54
54
  - spec/naturally_spec.rb
55
+ has_rdoc: