naturally 0.0.2 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -2,12 +2,8 @@
2
2
  *.rbc
3
3
  .bundle
4
4
  .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
5
  coverage
10
- doc/
6
+ InstalledFiles
11
7
  lib/bundler/man
12
8
  pkg
13
9
  rdoc
@@ -15,3 +11,8 @@ spec/reports
15
11
  test/tmp
16
12
  test/version_tmp
17
13
  tmp
14
+
15
+ # YARD artifacts
16
+ .yardoc
17
+ _yardoc
18
+ doc/
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # Naturally
2
2
 
3
- TODO: Write a gem description
3
+ Natural sorting with support for legal document numbering.
4
+ See [Counting to 10 in Californian](http://www.weblaws.org/blog/2012/08/counting-from-1-to-10-in-californian/)
5
+ for the motivations to make this library.
4
6
 
5
7
  ## Installation
6
8
 
@@ -18,7 +20,7 @@ Or install it yourself as:
18
20
 
19
21
  ## Usage
20
22
 
21
- TODO: Write usage instructions here
23
+ See the spec for examples.
22
24
 
23
25
  ## Contributing
24
26
 
@@ -1,3 +1,3 @@
1
1
  module Naturally
2
- VERSION = "0.0.2"
2
+ VERSION = "1.0.0"
3
3
  end
data/naturally.gemspec CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |gem|
8
8
  gem.version = Naturally::VERSION
9
9
  gem.authors = ["Robb Shecter"]
10
10
  gem.email = ["robb@weblaws.org"]
11
- gem.description = %q{Sorts numbers in string form according to the way people are used to seeing them.}
12
- gem.summary = %q{Natural Sorting}
11
+ gem.description = %q{Sorts numbers according to the way people are used to seeing them.}
12
+ gem.summary = %q{Natural Sorting with support for legal numbering}
13
13
  gem.homepage = "http://github.com/dogweather/naturally"
14
14
 
15
15
  gem.files = `git ls-files`.split($/)
@@ -0,0 +1,35 @@
1
+ require 'naturally'
2
+
3
+ describe Naturally do
4
+ describe '#sort' do
5
+ it 'sorts an array of strings nicely as if they were legal numbers' do
6
+ a = %w[676 676.1 676.11 676.12 676.2 676.3 676.9 676.10]
7
+ b = %w[676 676.1 676.2 676.3 676.9 676.10 676.11 676.12]
8
+ Naturally.sort(a).should == b
9
+ end
10
+
11
+ it 'sorts a smaller array of strings nicely as if they were legal numbers' do
12
+ a = %w[676 676.1 676.11 676.12 676.2 676.3 676.9]
13
+ b = %w[676 676.1 676.2 676.3 676.9 676.11 676.12]
14
+ Naturally.sort(a).should == b
15
+ end
16
+
17
+ it 'sorts a more complex list of strings' do
18
+ a = %w[350 351 352 352.1 352.5 353.1 354 354.3 354.4 354.45 354.5]
19
+ b = %w[350 351 352 352.1 352.5 353.1 354 354.3 354.4 354.5 354.45]
20
+ Naturally.sort(a).should == b
21
+ end
22
+
23
+ it 'sorts when numbers have letters in them' do
24
+ a = %w[335 335.1 336a 336 337 337a 337.1 337.15 337.2]
25
+ b = %w[335 335.1 336 336a 337 337.1 337.2 337.15 337a]
26
+ Naturally.sort(a).should == b
27
+ end
28
+
29
+ it 'sorts double digits with letters correctly' do
30
+ a = %w[12a 12b 12c 13a 13b 2 3 4 5 10 11 12]
31
+ b = %w[2 3 4 5 10 11 12 12a 12b 12c 13a 13b]
32
+ Naturally.sort(a).should == b
33
+ end
34
+ end
35
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: naturally
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 1.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,8 +11,7 @@ bindir: bin
11
11
  cert_chain: []
12
12
  date: 2012-12-08 00:00:00.000000000 Z
13
13
  dependencies: []
14
- description: Sorts numbers in string form according to the way people are used to
15
- seeing them.
14
+ description: Sorts numbers according to the way people are used to seeing them.
16
15
  email:
17
16
  - robb@weblaws.org
18
17
  executables: []
@@ -27,6 +26,7 @@ files:
27
26
  - lib/naturally.rb
28
27
  - lib/naturally/version.rb
29
28
  - naturally.gemspec
29
+ - spec/naturally_spec.rb
30
30
  homepage: http://github.com/dogweather/naturally
31
31
  licenses: []
32
32
  post_install_message:
@@ -50,5 +50,6 @@ rubyforge_project:
50
50
  rubygems_version: 1.8.24
51
51
  signing_key:
52
52
  specification_version: 3
53
- summary: Natural Sorting
54
- test_files: []
53
+ summary: Natural Sorting with support for legal numbering
54
+ test_files:
55
+ - spec/naturally_spec.rb