indefinite_article 0.2.0 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e5c3679787f469ac5dd3f056e78100366c0530f4
4
+ data.tar.gz: 6d39653ad27a1b83dab37d2f8b3441234e1eb6d9
5
+ SHA512:
6
+ metadata.gz: 2469b55010638a45adf6d57fa70cec6f6ef611a2586f76690fe432fe65f05070a1408ed358cd4db154b6cf9b0ca1153b39fd4a6401f3724caca967899f757799
7
+ data.tar.gz: df484da773604bdb594d71b06737a5b554f746405cbca07768e88e2ff8ecaef3fd5afcb2f1e8f850a383b629e4b7d0ba273f3618f581d74386debc2682ae6388
@@ -16,7 +16,13 @@ Gem::Specification.new do |s|
16
16
  'lib/indefinite_article.rb',
17
17
  'lib/indefinite_article/version.rb'
18
18
  ]
19
+ s.test_files = [
20
+ 'test/test_indefinite_article.rb'
21
+ ]
22
+
19
23
  s.require_paths = ["lib"]
20
24
  s.add_dependency 'activesupport'
25
+ s.add_development_dependency 'minitest', '~> 5.1'
21
26
  s.add_development_dependency 'i18n'
22
- end
27
+ s.add_development_dependency 'rake'
28
+ end
@@ -3,8 +3,8 @@ require 'active_support/core_ext/string'
3
3
 
4
4
  module IndefiniteArticle
5
5
 
6
- A_REQUIRING_PATTERNS = /^(([bcdgjkpqtuvwyz]|onc?e|onetime)$|e[uw]|uk|uni(l[^l]|[a-ko-z]))/i
7
- AN_REQUIRING_PATTERNS = /^([aefhilmnorsx]$|hono|honest|hour|heir|[aeiou])/i
6
+ A_REQUIRING_PATTERNS = /^(([bcdgjkpqtuvwyz]|onc?e|onearmed|onetime|ouija|oaxaca|oaxacan|oaxacania|oaxacanthaxia)$|e[uw]|uk|ubi|ubo|ufo|ur[aeiou]|use|ut([^t])|unani|uni(l[^l]|[a-ko-z]))/i
7
+ AN_REQUIRING_PATTERNS = /^([aefhilmnorsx]$|hono|honest|hour|heir|[aeiou]|8|11)/i
8
8
  UPCASE_A_REQUIRING_PATTERNS = /^(UN$)/
9
9
  UPCASE_AN_REQUIRING_PATTERNS = /^$/ #need if we decide to support acronyms like "XL" (extra-large)
10
10
 
@@ -15,7 +15,7 @@ module IndefiniteArticle
15
15
  'an'
16
16
  else
17
17
  'a'
18
- end
18
+ end unless first_word.nil?
19
19
  end
20
20
 
21
21
  def with_indefinite_article(upcase = false)
@@ -1,3 +1,3 @@
1
1
  module IndefiniteArticle
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.4"
3
3
  end
@@ -0,0 +1,105 @@
1
+ require File.expand_path('../helper', __FILE__)
2
+
3
+ class TestIndefiniteArticle < Minitest::Test
4
+ AN_WORDS = %w{
5
+ apple
6
+ unassailable
7
+ ubuntu
8
+ ubersexual
9
+ ungrammatical
10
+ unanswered
11
+ unilluminated
12
+ unintentional
13
+ unlikely
14
+ honor
15
+ honorable
16
+ onerous
17
+ hour
18
+ honest
19
+ heir
20
+ utter
21
+ urgent
22
+ a e f h i l m n o r s x
23
+ 8 11
24
+ }
25
+
26
+ A_WORDS = %w{
27
+ ukulele
28
+ UN
29
+ uk
30
+ oaxaca
31
+ oaxacan
32
+ oaxacania
33
+ oaxacanthaxia
34
+ ufo
35
+ unanimous
36
+ one
37
+ onearmed
38
+ once
39
+ onetime
40
+ ouija
41
+ european
42
+ ewe
43
+ ubiquity
44
+ uboat
45
+ unicorn
46
+ unilateral
47
+ banana
48
+ user
49
+ useful
50
+ urinologist
51
+ urea
52
+ b c d g j k p q t u v w y z
53
+ 1 2 3 4 5 6 7 9 10 12 13 14 15 16 17 18 19 20
54
+ }
55
+
56
+ def setup
57
+ end
58
+
59
+ def test_active_support
60
+ assert_equal 'banana'.first, 'b'
61
+ end
62
+
63
+ def test_indefinite_article_selection_for_an
64
+ AN_WORDS.each do |word|
65
+ assert_equal "an", word.indefinite_article, "word: #{word}"
66
+ assert_equal "an", word.upcase.indefinite_article, "word: #{word.upcase}"
67
+ end
68
+ end
69
+
70
+ def test_indefinite_article_selection_for_a
71
+ A_WORDS.each do |word|
72
+ assert_equal "a", word.indefinite_article, "word: #{word}"
73
+ assert_equal "a", word.upcase.indefinite_article, "word: #{word.upcase}"
74
+ end
75
+ end
76
+
77
+ def test_indefinite_article_selection_case_insensitvity
78
+ assert_equal "a", "bananna".indefinite_article
79
+ assert_equal "a", "Bananna".indefinite_article
80
+ assert_equal "an", "apple".indefinite_article
81
+ assert_equal "an", "Apple".indefinite_article
82
+ end
83
+
84
+ def test_phrases
85
+ assert_equal 'a', 'banana of yummieness'.indefinite_article
86
+ assert_equal 'an', 'honor-seeking person'.indefinite_article
87
+ end
88
+
89
+ def test_indefinitize
90
+ assert_equal 'a banana', 'banana'.indefinitize
91
+ assert_equal 'an apple', 'apple'.indefinitize
92
+ end
93
+
94
+ def test_functionality_on_symbol
95
+ assert_equal 'a', :banana.indefinite_article
96
+ end
97
+
98
+ def test_indefinite_article_prefix
99
+ assert_equal 'a banana', 'banana'.with_indefinite_article
100
+ end
101
+
102
+ def test_empty_string
103
+ assert_equal '', ''.indefinitize
104
+ end
105
+ end
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: indefinite_article
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
5
- prerelease:
4
+ version: 0.2.4
6
5
  platform: ruby
7
6
  authors:
8
7
  - Andrew Rossmeissl
@@ -10,38 +9,62 @@ authors:
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2012-12-17 00:00:00.000000000 Z
12
+ date: 2015-05-28 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: activesupport
17
16
  requirement: !ruby/object:Gem::Requirement
18
- none: false
19
17
  requirements:
20
- - - ! '>='
18
+ - - ">="
21
19
  - !ruby/object:Gem::Version
22
20
  version: '0'
23
21
  type: :runtime
24
22
  prerelease: false
25
23
  version_requirements: !ruby/object:Gem::Requirement
26
- none: false
27
24
  requirements:
28
- - - ! '>='
25
+ - - ">="
29
26
  - !ruby/object:Gem::Version
30
27
  version: '0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: minitest
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: '5.1'
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: '5.1'
31
42
  - !ruby/object:Gem::Dependency
32
43
  name: i18n
33
44
  requirement: !ruby/object:Gem::Requirement
34
- none: false
35
45
  requirements:
36
- - - ! '>='
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: rake
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
37
61
  - !ruby/object:Gem::Version
38
62
  version: '0'
39
63
  type: :development
40
64
  prerelease: false
41
65
  version_requirements: !ruby/object:Gem::Requirement
42
- none: false
43
66
  requirements:
44
- - - ! '>='
67
+ - - ">="
45
68
  - !ruby/object:Gem::Version
46
69
  version: '0'
47
70
  description: Adds indefinite article methods to String and Symbol
@@ -54,28 +77,29 @@ files:
54
77
  - indefinite_article.gemspec
55
78
  - lib/indefinite_article.rb
56
79
  - lib/indefinite_article/version.rb
80
+ - test/test_indefinite_article.rb
57
81
  homepage: http://github.com/rossmeissl/indefinite_article
58
82
  licenses: []
83
+ metadata: {}
59
84
  post_install_message:
60
85
  rdoc_options: []
61
86
  require_paths:
62
87
  - lib
63
88
  required_ruby_version: !ruby/object:Gem::Requirement
64
- none: false
65
89
  requirements:
66
- - - ! '>='
90
+ - - ">="
67
91
  - !ruby/object:Gem::Version
68
92
  version: '0'
69
93
  required_rubygems_version: !ruby/object:Gem::Requirement
70
- none: false
71
94
  requirements:
72
- - - ! '>='
95
+ - - ">="
73
96
  - !ruby/object:Gem::Version
74
97
  version: '0'
75
98
  requirements: []
76
99
  rubyforge_project:
77
- rubygems_version: 1.8.24
100
+ rubygems_version: 2.2.2
78
101
  signing_key:
79
- specification_version: 3
102
+ specification_version: 4
80
103
  summary: Adds indefinite article methods to String and Symbol
81
- test_files: []
104
+ test_files:
105
+ - test/test_indefinite_article.rb