number_name_string 0.1.2 → 0.2.0

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: 18389d8f60a893aae5cbc7bafcb6203bff2144d1
4
- data.tar.gz: e3352b3fd2905adfb213e5153892997de7de0ae0
3
+ metadata.gz: 1656d761433863430d537e773c037f89a5880f7a
4
+ data.tar.gz: e211242393e3d38f1424052a310d46b3935f1ddc
5
5
  SHA512:
6
- metadata.gz: b76e1acd8070fe2756ae0287403ff4c66ad9d4e6346a7f4af8b37f7a7171f026a8b0a19671835449bda7c2994d440e1647de7d25f20f0ecd7d50661ecc6570a9
7
- data.tar.gz: ba86416c7e94971515aefd578db46c611b19070ec6397da20dca1ce5ebfe8e1424a4142359d6a9de362886863194ac1319d5eefba744427b415052acd4251122
6
+ metadata.gz: 12569bbb09d87e77a104c3bbd0201f0213821ca353182291adf5d8a63402741ab43762aefe94411d74600647a02c8eb92519f76d57339bf9e4f9c757a6b0ac7e
7
+ data.tar.gz: e0c72e14ad5ed07aad95e51664b8a0f8ef8cd1a23b33bdae4d5d83584ed3504febcb80c1f5ddfdcc5812f60decf0cbf17ef1a61ae28616473bc179499bb4bb76
data/.gitignore CHANGED
@@ -7,3 +7,4 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ .*.sw?
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # NumberNameString
2
2
 
3
- Converts to and from numbers and names (ie: 16.to_name == 'sixteen', 'forty.to_i == 40).
3
+ Converts between numbers and their cardinal (ex: two) and ordinal (ex: second) names.
4
4
 
5
5
  Pure Ruby with no dependencies outside of the standard library.
6
6
 
@@ -41,7 +41,8 @@ Or, as a mixin directly on Fixnum and String classes:
41
41
 
42
42
  ```ruby
43
43
  include NumberNameString
44
- 716.to_name # "seven hundred sixteen"
44
+ 716.to_cardinal # "seven hundred sixteen"
45
+ 716.to_ordinal # "seven hundred sixteenth"
45
46
  "four thousand two".to_i # 4002
46
47
  91346.to_comma # "91,346"
47
48
  'five thousand'.to_comma # "5,000"
@@ -55,7 +56,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
55
56
 
56
57
  ## Contributing
57
58
 
58
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/number_name_string. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
59
+ Bug reports and pull requests are welcome on GitHub at https://github.com/robzr/number_name_string. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
59
60
 
60
61
  ## License
61
62
 
@@ -4,33 +4,50 @@ require_relative '../lib/number_name_string'
4
4
 
5
5
  include NumberNameString
6
6
 
7
- # Test Fixnum extension to_comma
8
- puts "1000.to_comma: #{1000.to_comma}"
9
- puts "\'1000\'.to_comma: #{'1000'.to_comma}"
10
-
11
- # Test String.to_i
12
- puts "'one hundered'.to_i: #{'one hundred'.to_i}"
13
-
14
- # Call as a module method
15
- puts "Module method ([]): #{NumberNameString[100]}"
16
- puts "Module method (<<): #{NumberNameString << 100}"
17
-
18
- # Instantiate and call
19
7
  nnsc = NumberNameString::Convert.new
20
- puts "Class method ([]): #{nnsc[100]}"
21
- puts "Class method (<<): #{nnsc << 100}"
22
8
 
23
- # Print table of test numbers
24
- TEST_NUMBERS = [(0..22).to_a +
25
- (98..102).to_a +
26
- (999998..1000001).to_a +
27
- [87006200514255917]].flatten.freeze
9
+ # Test various syntaxes
10
+ { '1000.to_comma' => "1,000",
11
+ '"1000".to_comma' => "1,000",
12
+ '"one hundred".to_i' => 100,
13
+ 'NumberNameString[100]' => 'one hundred',
14
+ 'NumberNameString["one hundred"]' => 100,
15
+ 'nnsc[100]' => 'one hundred',
16
+ 'nnsc["one hundred"]' => 100,
17
+ 'nnsc["fourteen hundred"]' => 1400,
18
+ 'nnsc["fourteen hundred ninetysix"]' => 1496,
19
+ }.each do |statement, result|
20
+ eval_result = eval statement
21
+ unless eval_result == result
22
+ puts "ERROR(0): '#{statement}' == '#{eval_result}' instead of '#{result}'"
23
+ end
24
+ end
25
+
26
+ # Generate numbers, convert to string and back to number, compare results
27
+ [(0..22).to_a +
28
+ (98..102).to_a +
29
+ (999998..1000001).to_a +
30
+ [87006200514255917]].flatten.each do |num|
31
+ unless num.to_comma == NumberNameString[num].to_comma
32
+ print "ERROR(1): "
33
+ printf("%s -> \"%s\" -> %s -> %s\n",
34
+ num.to_comma,
35
+ NumberNameString[num],
36
+ NumberNameString[num].to_i,
37
+ NumberNameString[num].to_comma)
38
+ end
39
+ end
28
40
 
29
- TEST_NUMBERS.each do |num|
30
- rendered = NumberNameString[num]
31
- unrendered = NumberNameString[rendered]
32
- printf("%-10s -> %-10s -> \"%s\"\n",
33
- num.to_comma,
34
- NumberNameString[unrendered],
35
- rendered)
41
+ # Compare series of strings to numbers
42
+ { 'zero' => 0,
43
+ 'six' => 6,
44
+ 'fiftytwo' => 52,
45
+ 'six hundred' => 600,
46
+ 'seven hundred fortytwo' => 742,
47
+ 'six hundred thousand' => 600000,
48
+ 'six hundred fourteen thousand two hundred sixtytwo' => 614262
49
+ }.each do |name, num|
50
+ unless num.to_name == name
51
+ puts "ERROR(2): \"#{name}\".to_i -> #{num} -> #{num.to_name}"
52
+ end
36
53
  end
@@ -1,13 +1,19 @@
1
- require_relative "number_name_string/convert"
2
- require_relative "number_name_string/version"
1
+ require_relative 'number_name_string/convert'
2
+ require_relative 'number_name_string/constants'
3
+ require_relative 'number_name_string/lookup'
4
+ require_relative 'number_name_string/triplet'
5
+ require_relative 'number_name_string/version'
3
6
 
4
7
  module NumberNameString
8
+
5
9
  class NumberNameStringError < ArgumentError ; end
6
10
 
7
- # Would be ideal if we could only add this functionality only if included
11
+ class NumberNameParseError < ArgumentError ; end
12
+
13
+ # Extends Fixnum class with to_comma and to_name
8
14
  class ::Fixnum
9
15
  def to_comma
10
- self.to_s.to_comma
16
+ self.to_s.add_commas
11
17
  end
12
18
 
13
19
  def to_name
@@ -15,22 +21,28 @@ module NumberNameString
15
21
  end
16
22
  end
17
23
 
18
- # Would be ideal if we could only add this functionality only if included
24
+ # Extends String class with to_comma and updated to_i
19
25
  class ::String
20
26
  alias_method :old_to_i, :to_i
21
27
 
22
28
  def to_comma
29
+ self.to_i.to_comma
30
+ end
31
+
32
+ def add_commas
23
33
  self.reverse.gsub(/(\d{3})(?=\d)/, '\\1,').reverse
24
34
  end
25
35
 
26
36
  def to_i
27
- # TODO: verify output may be a string and this is necessary
28
- result = NumberNameString[self]
29
- result.is_a?(String) ? result.old_to_i : result
37
+ if self =~ /^\d+$/
38
+ old_to_i
39
+ else
40
+ NumberNameString[self]
41
+ end
30
42
  end
31
43
  end
32
44
 
33
45
  def self.[](num)
34
- (instance ||= NumberNameString::Convert.new)[num]
46
+ (@instance ||= NumberNameString::Convert.new)[num]
35
47
  end
36
48
  end
@@ -0,0 +1,39 @@
1
+ module NumberNameString
2
+ # Cardinal Numbers & Scales
3
+ ONES = [:zero, :one, :two, :three, :four, :five, :six, :seven, :eight,
4
+ :nine].freeze
5
+ TEENS = [:ten, :eleven, :twelve, :thirteen, :fourteen, :fifteen, :sixteen,
6
+ :seventeen, :eighteen, :nineteen].freeze
7
+ TENS = [:twenty, :thirty, :forty, :fifty, :sixty, :seventy, :eighty,
8
+ :ninety].freeze
9
+ SCALES = [nil, :thousand, :million, :billion, :trillion, :quadrillion,
10
+ :quintillion, :sextillion, :septillion, :octillion, :nonillion,
11
+ :decillion, :undecillion, :duodecillion, :tredecillion,
12
+ :quattuordecillion, :quindecillion, :sexdecillion, :septendecillion,
13
+ :octodecillion, :novemdecillion, :vigintillion]
14
+
15
+ # Ordinal Numbers & Scales
16
+ ORD_ONES = [:zeroth, :first, :second, :third, :fourth, :fifth, :sixth,
17
+ :seventh, :eighth, :ninth].freeze
18
+ ORD_TEENS = ([:tenth, :eleventh, :twelfth] +
19
+ TEENS[3..9].map { |teen| "#{teen}th".to_sym }).freeze
20
+ ORD_TENS = TENS.map { |ten| ten.to_s.sub(/y$/, 'ieth').to_sym }.freeze
21
+ ORD_SCALES = SCALES.map { |scale| "#{scale}th".to_sym if scale }
22
+
23
+ SCALE_MAX = (SCALES.length - 1) * 3
24
+
25
+ # Common mispellings
26
+ MISPELLINGS = {
27
+ :fourty => 40, :fourtieth => 40,
28
+ :fourtyone => 41, :fourtifirst => 41,
29
+ :fourtytwo => 42, :fourtisecond => 42,
30
+ :fourtythree => 43, :fourtithird => 43,
31
+ :fourtyfour => 44, :fourtifourth => 44,
32
+ :fourtyfive => 45, :fourtififth => 45,
33
+ :fourtysix => 46, :fourtisixth => 46,
34
+ :fourtyseven => 47, :fourtiseventh => 47,
35
+ :fourtyeight => 48, :fourtieighth => 48,
36
+ :fourtynine => 49, :fourtininth => 49,
37
+ :hundered => 100, :hunderedth => 100
38
+ }
39
+ end
@@ -1,26 +1,20 @@
1
1
  module NumberNameString
2
+ # Handles conversion logic, takes full number (string or numeric), parses
3
+ # and accumulates results from lookup tables
2
4
  class Convert
3
- #
4
- # TODO: convert to arrays for multiple spellings
5
- # - [forty, fourty]
6
- # - [hundred, hundered]
7
- #
8
- ONES = %W{ #{} one two three four five six seven eight nine }
9
- ONES_ZERO = %W{ zero one two three four five six seven eight nine }
10
- TEENS = %w{ ten eleven twelve thirteen fourteen fifteen sixteen
11
- seventeen eighteen nineteen }
12
- TENS = %W{ #{} #{} twenty thirty forty fifty sixty seventy eighty ninety }
13
- SCALE = %W{ #{} thousand million billion trillion quadrillion quintillion
14
- sextillion septillion octillion nonillion decillion undecillion duodecillion
15
- tredecillion quattuordecillion quindecillion sexdecillion septendecillion
16
- octodecillion novemdecillion vigintillion }
17
- SCALE_MAX = (SCALE.length - 1) * 3
5
+ def initialize(num = nil)
6
+ @lookup = Lookup.instance
7
+ @num = num
8
+ @num_struct = Struct.new(:word, :type, :number)
9
+ end
18
10
 
19
- def [](arg)
11
+ def [](arg = @num)
20
12
  if arg.is_a? Fixnum
21
- to_s arg
13
+ num_to_string arg
22
14
  elsif arg.is_a? String
23
- to_i arg
15
+ string_to_num arg
16
+ elsif arg.is_a? Symbol
17
+ string_to_num arg.to_s
24
18
  else
25
19
  raise NumberNameStringError.new("Invalid arg type: #{arg.class.name}")
26
20
  end
@@ -28,112 +22,88 @@ module NumberNameString
28
22
 
29
23
  alias << []
30
24
 
31
- def to_i(arg)
32
- num = 0
33
- words = arg.downcase.gsub('-', '').split(/\s+/)
34
- while word = words.shift
35
- accum = 0
36
- # (sub_hundred | ones(false) hundred [sub_hundred] )[scale]]
37
- if sub_hundred?(word)
38
- if ones?(word, false) && hundred?(words[0])
39
- accum += ones?(word) * 100
40
- words.shift
41
- word = words.shift
42
- else
43
- accum += sub_hundred?(word)
44
- end
45
- word = words.shift
46
- if scale? word
47
- accum *= scale? word
48
- end
25
+ # Converts a string to a number
26
+ #
27
+ # @param arg [String] number to convert
28
+ # @returns [Integer] number
29
+ def string_to_num(arg = @num)
30
+ total = 0
31
+ triplet = Triplet.new
32
+ words = num_string_to_array arg
33
+ marker = words.length
34
+ while marker > 0
35
+ marker -= 1
36
+ word = words[marker]
37
+ if word.type == :number
38
+ triplet << word.number
39
+ end
40
+ if word.type == :scale || marker == 0
41
+ triplet.scale = word.number if word.type == :scale
42
+ total += triplet.to_i
43
+ triplet.reset
49
44
  end
50
- # puts "accum: #{accum}"
51
- num += accum
52
45
  end
53
- num
46
+ total
54
47
  end
55
48
 
56
- def to_s(num, include_zero = true)
57
- case digits = num.to_s.length
58
- when 1
59
- include_zero ? ONES_ZERO[num] : ONES[num]
60
- when 2
61
- num < 20 ? TEENS[num - 10] : "#{TENS[num / 10]}#{ONES[num % 10]}"
62
- when 3
63
- "#{ONES[num / 100]} hundred#{space_pad(to_s(num % 100, false))}"
64
- when (4..SCALE_MAX)
65
- zeros = 10 ** (((digits - 1) / 3) * 3)
66
- "%s%s%s" % [to_s(num / zeros, false),
67
- space_pad(SCALE[(digits - 1) / 3]),
68
- space_pad(to_s(num % zeros, false))]
69
- else
70
- raise NumberNameStringError.new('Number out of range')
71
- end
49
+ # Converts a number to a string
50
+ #
51
+ # @param num [Integer] number to convert
52
+ # @param type [Symbol] convert to type :cardinal or :ordinal
53
+ # @returns [String] name of number
54
+ def num_to_string(num = @num, type = :cardinal)
55
+ name = ''
56
+ num_to_triplets(num).each_with_index.reverse_each do |triplet, index|
57
+ name += " #{name_triplet triplet} #{SCALES[index]}" if triplet > 0
58
+ end
59
+ name == '' ? 'zero' : name.sub(/^\s*/, '').sub(/\s*$/, '')
72
60
  end
73
61
 
74
62
  private
75
63
 
76
- # ONES = %W{ #{} one two three four five six seven eight nine }
77
- # ONES_ZERO = %W{ zero one two three four five six seven eight nine }
78
- # TEENS = %w{ ten eleven twelve thirteen fourteen fifteen sixteen
79
- # seventeen eighteen nineteen }
80
- # TENS = %W{ #{} #{} twenty thirty fourty fifty sixty seventy eighty ninety }
81
- # SCALE = %W{ #{} thousand million billion trillion quadrillion quintillion
82
-
83
- def hundred?(word)
84
- word == 'hundred' && 100
85
- end
86
-
87
- def number?(word)
88
- ones?(word) || teens?(word) || tens?(word) || hundred?(word)
64
+ # Cleans and splits string
65
+ #
66
+ # @param arg [String] string to split & convert
67
+ # @returns [Array] array of symbols
68
+ def clean_and_split(arg)
69
+ arg.downcase
70
+ .gsub('-', '')
71
+ .gsub(/\band\b/, '')
72
+ .split(/\s+/)
73
+ .map { |word| word.to_sym }
89
74
  end
90
75
 
91
- def ones?(word, with_zero = true)
92
- if with_zero
93
- ONES_ZERO.find_index word
76
+ # Converts a triplet (1-3 digit number) to a string
77
+ #
78
+ # @param arg [Integer] number to convert
79
+ # @param type [Symbol] :cardinal or :ordinal
80
+ # @returns [String] name of number
81
+ def name_triplet(num, type = :cardinal)
82
+ if num >= 100
83
+ name = "#{@lookup.cardinal(num / 100)} hundred"
84
+ name += " #{@lookup.cardinal(num % 100)}" unless num % 100 == 0
85
+ name
94
86
  else
95
- ONES.find_index word
87
+ @lookup.cardinal num
96
88
  end
97
89
  end
98
90
 
99
- def scale?(word)
100
- _ = SCALE.find_index word
101
- 10 ** (_ * 3) if _
102
- end
103
-
104
- def space_pad(arg)
105
- if arg.is_a?(NilClass) || arg == ''
106
- ''
107
- elsif arg =~ /^\s/
108
- arg
91
+ def num_to_triplets(num = @num)
92
+ str = num.to_s
93
+ if str.length % 3 == 0
94
+ str
109
95
  else
110
- " #{arg}"
111
- end
112
- end
113
-
114
- def sub_hundred?(word)
115
- ones?(word) || teens?(word) || tens?(word)
96
+ str.rjust((3 - str.length % 3) + str.length, '0')
97
+ end.scan(/\d{3}/)
98
+ .map(&:to_i)
99
+ .reverse
116
100
  end
117
101
 
118
- def teens?(word)
119
- _ = TEENS.find_index word
120
- _ + 10 if _
121
- end
122
-
123
- def tens?(word)
124
- if TENS.find_index(word)
125
- TENS.find_index(word) * 10
126
- elsif tens_prefix?(word)
127
- prefix = tens_prefix?(word)
128
- suffix = word.slice(prefix.length, 100)
129
- if ones?(suffix, false)
130
- TENS.find_index(prefix) * 10 + ones?(suffix, false)
131
- end
102
+ def num_string_to_array(arg)
103
+ clean_and_split(arg).reverse.map do |word|
104
+ number, type = @lookup.number word
105
+ @num_struct.new(word, type, number)
132
106
  end
133
107
  end
134
-
135
- def tens_prefix?(word)
136
- TENS.select { |prefix| prefix != "" && word =~ /^#{prefix}/ }.first
137
- end
138
108
  end
139
109
  end
@@ -0,0 +1,90 @@
1
+ module NumberNameString
2
+ # Singleton class which generates translation tables on demand
3
+ # Converts a single name into a number or a 0-100 into a name
4
+ class Lookup
5
+ require 'pp'
6
+ require 'singleton'
7
+ include Singleton
8
+
9
+ # Lookup cardinal number name (ex: two)
10
+ #
11
+ # @param[Fixnum] number to convert (between 0-100)
12
+ # @return[String]
13
+ def cardinal(number)
14
+ lookup_cardinal[number]
15
+ end
16
+
17
+ # Lookup single word, return number or scale
18
+ # @return[Fixnum, Symbol]
19
+ def number(name)
20
+ if _ = lookup_name[name]
21
+ [_, :number]
22
+ elsif _ = lookup_scale[name]
23
+ [_, :scale]
24
+ else
25
+ raise NumberNameParseError.new("Parse error on: #{name}")
26
+ end
27
+ end
28
+
29
+ # Lookup ordinal number name (ex: second)
30
+ #
31
+ # @param[Fixnum] number to convert (between 0-100)
32
+ # @return[String]
33
+ def ordinal(number)
34
+ lookup_ordinal[number]
35
+ end
36
+
37
+ private
38
+
39
+ def generate_cardinal_table
40
+ ONES + TEENS + TENS.map do |prefix|
41
+ [prefix] + ONES[1..9].map { |suffix| "#{prefix}#{suffix}".to_sym }
42
+ end.flatten
43
+ end
44
+
45
+ def generate_name_table
46
+ table = {}
47
+ (ONES + TEENS).each.with_index { |name, number| table[name] = number }
48
+ TENS.each.with_index do |prefix, number|
49
+ number = (number + 2) * 10
50
+ table[prefix] = number
51
+ ONES[1..9].each do |suffix|
52
+ number += 1
53
+ table["#{prefix}#{suffix}".to_sym] = number
54
+ end
55
+ end
56
+ table.merge({ :hundred => 100}).merge MISPELLINGS
57
+ end
58
+
59
+ def generate_ordinal_table
60
+ ORD_ONES + ORD_TEENS + TENS.map do |prefix|
61
+ [prefix] + ORD_ONES[1..9].map { |suffix| "#{prefix}#{suffix}".to_sym }
62
+ end.flatten
63
+ end
64
+
65
+ def generate_scale_table
66
+ table = {}
67
+ SCALES.each.with_index do |scale, index|
68
+ size = 10 ** (index * 3)
69
+ table[scale] = size if scale
70
+ end
71
+ table
72
+ end
73
+
74
+ def lookup_cardinal
75
+ @lookup_cardinal ||= generate_cardinal_table
76
+ end
77
+
78
+ def lookup_name
79
+ @lookup_name ||= generate_name_table
80
+ end
81
+
82
+ def lookup_ordinal
83
+ @lookup_ordinal ||= generate_ordinal_table
84
+ end
85
+
86
+ def lookup_scale
87
+ @lookup_scale ||= generate_scale_table
88
+ end
89
+ end
90
+ end
@@ -0,0 +1,27 @@
1
+ module NumberNameString
2
+ # Accumulates and totals a 3 digit number (with an optional scale)
3
+ # Used internally only.
4
+ class Triplet
5
+ attr_accessor :hundreds, :tens, :scale
6
+
7
+ def initialize(num = 0)
8
+ reset num
9
+ end
10
+
11
+ def <<(num)
12
+ @hundreds = @tens if @tens > 0
13
+ @tens = num % 100
14
+ end
15
+
16
+ def to_i
17
+ (@hundreds * 100 + @tens) * @scale
18
+ end
19
+
20
+ def reset(num = 0)
21
+ @hundreds = 0
22
+ @tens = num
23
+ @scale = 1
24
+ end
25
+ end
26
+ end
27
+
@@ -1,3 +1,3 @@
1
1
  module NumberNameString
2
- VERSION = "0.1.2"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,55 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: number_name_string
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rob Zwissler
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-01-04 00:00:00.000000000 Z
11
+ date: 2017-01-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.13'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.13'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ~>
32
32
  - !ruby/object:Gem::Version
33
33
  version: '10.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ~>
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ~>
46
46
  - !ruby/object:Gem::Version
47
47
  version: '3.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ~>
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.0'
55
55
  description: 'Converts to and from numbers and names (ie: 16.to_name == ''sixteen'',
@@ -60,9 +60,9 @@ executables: []
60
60
  extensions: []
61
61
  extra_rdoc_files: []
62
62
  files:
63
- - ".gitignore"
64
- - ".rspec"
65
- - ".travis.yml"
63
+ - .gitignore
64
+ - .rspec
65
+ - .travis.yml
66
66
  - CODE_OF_CONDUCT.md
67
67
  - Gemfile
68
68
  - LICENSE.txt
@@ -72,7 +72,10 @@ files:
72
72
  - bin/setup
73
73
  - bin/test.rb
74
74
  - lib/number_name_string.rb
75
+ - lib/number_name_string/constants.rb
75
76
  - lib/number_name_string/convert.rb
77
+ - lib/number_name_string/lookup.rb
78
+ - lib/number_name_string/triplet.rb
76
79
  - lib/number_name_string/version.rb
77
80
  - number_name_string.gemspec
78
81
  homepage: https://github.com/robzr/number_name_string
@@ -85,17 +88,17 @@ require_paths:
85
88
  - lib
86
89
  required_ruby_version: !ruby/object:Gem::Requirement
87
90
  requirements:
88
- - - ">="
91
+ - - '>='
89
92
  - !ruby/object:Gem::Version
90
93
  version: '0'
91
94
  required_rubygems_version: !ruby/object:Gem::Requirement
92
95
  requirements:
93
- - - ">="
96
+ - - '>='
94
97
  - !ruby/object:Gem::Version
95
98
  version: '0'
96
99
  requirements: []
97
100
  rubyforge_project:
98
- rubygems_version: 2.5.1
101
+ rubygems_version: 2.0.14.1
99
102
  signing_key:
100
103
  specification_version: 4
101
104
  summary: 'Converts to and from numbers and names (ie: 16.to_name == ''sixteen'')'