linguistics 2.0.4 → 2.1.0

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: fdef8fce2a3ef1d42a5eebbee59b9da384cfe783
4
- data.tar.gz: b4bc7c0581b2f5b4a13af5a92e3217d0e35fdb20
3
+ metadata.gz: d34798efad8371fb583d6594d7e9301f30e0f386
4
+ data.tar.gz: 7f024ff2fd9d77ae71d1003456037aca606b44de
5
5
  SHA512:
6
- metadata.gz: 6bde8e8fda5a99fb34c1359ff223384244239b3b13050b95afe126a6e8205402edae8c442c67f40f93e3387642f1ee22ec031f80a80e860dc977927cef1bc669
7
- data.tar.gz: 1cf8553c4245c731e56a5c3543761aec0c2c9c5348fc248f10917ccc9feaf423120bf029c706db3b4a47e32a21831bc0e08f4c441ca17946b535ccafe8d162f7
6
+ metadata.gz: 5cddeae6bd28706064a428f6e7531bef96268d9e9579cab8f946e0648392f310b2b9e56d224ae4ec8881a77ece2405ae3ee749cbd9f4825abb2307d98015d57c
7
+ data.tar.gz: a2fc49f3d995041e10f260377024fad17f54a6abc0e6e915dc7d62094ecc34f22b97221f7987faa959bcd640f35f9563323fbbec9178a1f145b2bf5844b0176d
@@ -1 +1 @@
1
- Vyl�1���d"Z�����F{��/��O��.j�&��@oa�ş�92�� d{N%hm��I]�MP�e��
2
1
  ,����UN f[#l�� ��^UԿ�߫,�U��yE#��Yl�F�ktM���k$T�Rz���-]�v�X@����G念%��${��dsGjF��Α���g��a�΄E��f�#�
2
+ 0Ge�W�ڨ���ݠ�#}���cp�ai�¸�����̕�z��O�E�qe�0�K�BBu����r��2F����s̘*�~����yt �=�)�M������A��`,r\^���
data.tar.gz.sig CHANGED
Binary file
@@ -1,3 +1,8 @@
1
+ == v2.1.0 [2015-09-16] Michael Granger <ged@FaerieMUD.org>
2
+
3
+ - Add an `article` config item to English conjunctions.
4
+
5
+
1
6
  == v2.0.4 [2015-03-12] Michael Granger <ged@FaerieMUD.org>
2
7
 
3
8
  Updates and bugfixes for Ruby 2.2.
@@ -12,10 +12,10 @@ module Linguistics
12
12
 
13
13
 
14
14
  # Release version
15
- VERSION = '2.0.4'
15
+ VERSION = '2.1.0'
16
16
 
17
17
  # VCS version
18
- REVISION = %q$Revision: 32d9bdeaf0ea $
18
+ REVISION = %q$Revision: c4faf117867f $
19
19
 
20
20
  # The list of Classes to add linguistic behaviours to.
21
21
  DEFAULT_EXT_CLASSES = [ String, Numeric, Array ]
@@ -21,6 +21,7 @@ module Linguistics::EN::Conjunctions
21
21
  :casefold => true,
22
22
  :generalize => false,
23
23
  :quantsort => true,
24
+ :article => true,
24
25
  }
25
26
 
26
27
 
@@ -83,6 +84,10 @@ module Linguistics::EN::Conjunctions
83
84
  ### list. This sort is also the fallback for indentical quantities (ie.,
84
85
  ### items of the same quantity will be listed in the order they appeared
85
86
  ### in the source list).
87
+ ### [<b>:article</b>]
88
+ ### If set to <tt>true</tt> (the default), singular items in the list will be
89
+ ### prefixed with the appropriate indefinite article ("box" -> "a box"). Setting
90
+ ### it to +false+ will omit this.
86
91
  ###
87
92
  def conjunction( args={} )
88
93
  config = CONJUNCTION_DEFAULTS.merge( args )
@@ -101,7 +106,10 @@ module Linguistics::EN::Conjunctions
101
106
  self.log.debug " phrases is: %p" % [ phrases ]
102
107
 
103
108
  # No need for a conjunction if there's only one thing
104
- return phrases[0].en.a if phrases.length < 2
109
+ if phrases.length < 2
110
+ return phrases[0] unless config[:article]
111
+ return phrases[0].en.a
112
+ end
105
113
 
106
114
  # Set up a Proc to derive a collector key from a phrase depending on the
107
115
  # configuration
@@ -165,8 +173,11 @@ module Linguistics::EN::Conjunctions
165
173
  count < 10 ? count.en.numwords : count.to_s,
166
174
  phrase.en.plural( count )
167
175
  ]
168
- else
176
+ elsif config[:article]
169
177
  phrase.en.a
178
+ else
179
+ self.log.debug "No article!"
180
+ phrase
170
181
  end
171
182
  end
172
183
  end
@@ -59,6 +59,10 @@ describe Linguistics::EN::Conjunctions do
59
59
  expect( array.en.conjunction ).to eq( "a cat" )
60
60
  end
61
61
 
62
+ it "omits the indefinite article if :article is `false`" do
63
+ expect( array.en.conjunction(article: false) ).to eq( "cat" )
64
+ end
65
+
62
66
  end
63
67
 
64
68
 
@@ -78,6 +82,10 @@ describe Linguistics::EN::Conjunctions do
78
82
  expect( array.en.conjunction(:conjunctive => '') ).to eq( "a cat a dog" )
79
83
  end
80
84
 
85
+ it "doesn't add indefinite articles if :article is set to `false`" do
86
+ expect( array.en.conjunction( article: false ) ).to eq( "cat and dog" )
87
+ end
88
+
81
89
  end
82
90
 
83
91
 
@@ -120,6 +128,12 @@ describe Linguistics::EN::Conjunctions do
120
128
  'chicken, a goose, a Dog, and a goose' )
121
129
  end
122
130
 
131
+ it "omits the indefinite article if :article is `false`" do
132
+ expect( array.en.conjunction(combine: false, article: false) ).to eq(
133
+ 'cat, dog, fox, dog, chicken, chicken, Fox, '\
134
+ 'chicken, goose, Dog, and goose' )
135
+ end
136
+
123
137
  it "doesn't combine the differently-cased ones if :casefold is turned off" do
124
138
  expect( array.en.conjunction(:casefold => false) ).to eq(
125
139
  'three chickens, two dogs, two geese, a cat, a fox, a Fox, '\
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: linguistics
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.4
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Granger
@@ -12,7 +12,7 @@ cert_chain:
12
12
  -----BEGIN CERTIFICATE-----
13
13
  MIIDbDCCAlSgAwIBAgIBATANBgkqhkiG9w0BAQUFADA+MQwwCgYDVQQDDANnZWQx
14
14
  GTAXBgoJkiaJk/IsZAEZFglGYWVyaWVNVUQxEzARBgoJkiaJk/IsZAEZFgNvcmcw
15
- HhcNMTQwMzE5MDQzNTI2WhcNMTUwMzE5MDQzNTI2WjA+MQwwCgYDVQQDDANnZWQx
15
+ HhcNMTUwNDAxMjEyNDEzWhcNM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ykvETIOv+WgGcqp96ceNi9XVuJMh20uWuw6pmv/Ub2RqAf82jQSbpz09G
30
+ G8LHR7EjtPPmqCCunfyecJ6MmCNaiJCBxq2NYzyNmluPyHT8+0fuB5kccUVZm6CD
31
+ xn3DzOkDE6NYbk8gC9rTsA==
32
32
  -----END CERTIFICATE-----
33
- date: 2015-03-12 00:00:00.000000000 Z
33
+ date: 2015-09-16 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: loggability
@@ -66,14 +66,14 @@ dependencies:
66
66
  requirements:
67
67
  - - "~>"
68
68
  - !ruby/object:Gem::Version
69
- version: '0.6'
69
+ version: '0.7'
70
70
  type: :development
71
71
  prerelease: false
72
72
  version_requirements: !ruby/object:Gem::Requirement
73
73
  requirements:
74
74
  - - "~>"
75
75
  - !ruby/object:Gem::Version
76
- version: '0.6'
76
+ version: '0.7'
77
77
  - !ruby/object:Gem::Dependency
78
78
  name: hoe-highline
79
79
  requirement: !ruby/object:Gem::Requirement
@@ -271,7 +271,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
271
271
  version: '0'
272
272
  requirements: []
273
273
  rubyforge_project:
274
- rubygems_version: 2.4.5
274
+ rubygems_version: 2.4.7
275
275
  signing_key:
276
276
  specification_version: 4
277
277
  summary: Linguistics is a framework for building linguistic utilities for Ruby objects
metadata.gz.sig CHANGED
@@ -1,3 +1,3 @@
1
- w|�4{8��1E��EH2JLg���FP:���k߳��7��v]n�#C���Q��,�I
2
- .ӘÙ�_pˡD[G��N^M��qcL^%�3����0
3
- ��:�Ôs��vD�+F���u-��r]Y���S���F_���ת
1
+ ��.Ï%�!J�ru�����}�������+s UȈ'9
2
+ ��D���j\U�&�k 'K���/'�K����3��Ya��JQT���"'HE? ;LY& ?�4���_�����ra��'u 5(S!���V����]���x9F�;+�餌o�;l(癭�=
3
+ ��8�߫C琗qY�W�6���1 wW��{�'e�4MRfL�<:�xV>t�w��K�����/��~��vj߳�՞