money_in_words 1.0.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 +7 -0
- data/.gitignore +14 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +88 -0
- data/Rakefile +9 -0
- data/lib/money_in_words/core_ext/float.rb +5 -0
- data/lib/money_in_words/core_ext/integer.rb +9 -0
- data/lib/money_in_words/integer.rb +103 -0
- data/lib/money_in_words/money.rb +76 -0
- data/lib/money_in_words/version.rb +3 -0
- data/lib/money_in_words.rb +39 -0
- data/money_in_words.gemspec +25 -0
- data/scratchpad.rb +223 -0
- data/spec/money_in_words_spec.rb +152 -0
- data/spec/spec_helper.rb +15 -0
- metadata +117 -0
    
        checksums.yaml
    ADDED
    
    | @@ -0,0 +1,7 @@ | |
| 1 | 
            +
            ---
         | 
| 2 | 
            +
            SHA1:
         | 
| 3 | 
            +
              metadata.gz: 386cca35e9cbb23ea7edc7de5636421a490da873
         | 
| 4 | 
            +
              data.tar.gz: 38ff827111e84f2ed79f4b43cf420f86f4a21cdd
         | 
| 5 | 
            +
            SHA512:
         | 
| 6 | 
            +
              metadata.gz: d12fe6af1abcacee0aeb352dd465aa02c37d916725182b04105e28583c2dd27928ad54a472629a8affaa86ea7178f0fcc2efc0f436789be626a3fa6af7700731
         | 
| 7 | 
            +
              data.tar.gz: 72b2a1a4343edc8859f8317f30bc7f63b010848e44b013b10c77607919a6b181a48de6d7cc6fb409dd28a47ff05b2327f0cf1537595081ecf1609af5c13aa064
         | 
    
        data/.gitignore
    ADDED
    
    
    
        data/Gemfile
    ADDED
    
    
    
        data/LICENSE.txt
    ADDED
    
    | @@ -0,0 +1,22 @@ | |
| 1 | 
            +
            Copyright (c) 2014 gmitrev
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            MIT License
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            Permission is hereby granted, free of charge, to any person obtaining
         | 
| 6 | 
            +
            a copy of this software and associated documentation files (the
         | 
| 7 | 
            +
            "Software"), to deal in the Software without restriction, including
         | 
| 8 | 
            +
            without limitation the rights to use, copy, modify, merge, publish,
         | 
| 9 | 
            +
            distribute, sublicense, and/or sell copies of the Software, and to
         | 
| 10 | 
            +
            permit persons to whom the Software is furnished to do so, subject to
         | 
| 11 | 
            +
            the following conditions:
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            The above copyright notice and this permission notice shall be
         | 
| 14 | 
            +
            included in all copies or substantial portions of the Software.
         | 
| 15 | 
            +
             | 
| 16 | 
            +
            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
         | 
| 17 | 
            +
            EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
         | 
| 18 | 
            +
            MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
         | 
| 19 | 
            +
            NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
         | 
| 20 | 
            +
            LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
         | 
| 21 | 
            +
            OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
         | 
| 22 | 
            +
            WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
         | 
    
        data/README.md
    ADDED
    
    | @@ -0,0 +1,88 @@ | |
| 1 | 
            +
            # Money in Words
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            Turns numbers into words/money. Bulgarian only for the time being.
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            ## Installation
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            Add this line to your application's Gemfile:
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            ```ruby
         | 
| 10 | 
            +
            gem 'money_in_words'
         | 
| 11 | 
            +
            ```
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            And then execute:
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                $ bundle
         | 
| 16 | 
            +
             | 
| 17 | 
            +
            Or install it yourself as:
         | 
| 18 | 
            +
             | 
| 19 | 
            +
                $ gem install money_in_words
         | 
| 20 | 
            +
                
         | 
| 21 | 
            +
            ## Convert numbers to words
         | 
| 22 | 
            +
            Only works with integers:
         | 
| 23 | 
            +
             | 
| 24 | 
            +
                require "money_in_words"
         | 
| 25 | 
            +
                
         | 
| 26 | 
            +
                0.to_words
         | 
| 27 | 
            +
                => "нула"
         | 
| 28 | 
            +
                
         | 
| 29 | 
            +
                1.to_words
         | 
| 30 | 
            +
                => "един"
         | 
| 31 | 
            +
                
         | 
| 32 | 
            +
                1.to_words(article: :neuter)
         | 
| 33 | 
            +
                => "едно"
         | 
| 34 | 
            +
                
         | 
| 35 | 
            +
                1.to_words(article: :female)
         | 
| 36 | 
            +
                => "една"
         | 
| 37 | 
            +
                
         | 
| 38 | 
            +
                11.to_words
         | 
| 39 | 
            +
                => "единадесет"
         | 
| 40 | 
            +
                
         | 
| 41 | 
            +
                33.to_words
         | 
| 42 | 
            +
                => "тридесет и три"
         | 
| 43 | 
            +
                
         | 
| 44 | 
            +
                2000.to_words
         | 
| 45 | 
            +
                => "две хиляди"
         | 
| 46 | 
            +
                
         | 
| 47 | 
            +
                2001.to_words
         | 
| 48 | 
            +
                => "две хиляди и един"
         | 
| 49 | 
            +
                
         | 
| 50 | 
            +
                2001.to_words(article: :female)
         | 
| 51 | 
            +
                => "две хиляди и една"
         | 
| 52 | 
            +
             | 
| 53 | 
            +
             | 
| 54 | 
            +
            ## Conver numbers to money
         | 
| 55 | 
            +
             | 
| 56 | 
            +
                require "money_in_words"
         | 
| 57 | 
            +
             | 
| 58 | 
            +
                0.to_money
         | 
| 59 | 
            +
                => "нула лева"
         | 
| 60 | 
            +
                
         | 
| 61 | 
            +
                0.5.to_money
         | 
| 62 | 
            +
                => "нула лева и петдесет стотинки"
         | 
| 63 | 
            +
                
         | 
| 64 | 
            +
                0.5.to_money(show_zero_leva: false)
         | 
| 65 | 
            +
                => "петдесет стотинки"
         | 
| 66 | 
            +
                
         | 
| 67 | 
            +
                1.to_money
         | 
| 68 | 
            +
                => "един лев"
         | 
| 69 | 
            +
                
         | 
| 70 | 
            +
                1.to_money(show_zero_stotinki: true)
         | 
| 71 | 
            +
                => "един лев и нула стотинки"
         | 
| 72 | 
            +
                
         | 
| 73 | 
            +
                1.01.to_money
         | 
| 74 | 
            +
                => "един лев и една стотинка"
         | 
| 75 | 
            +
                
         | 
| 76 | 
            +
                1.5.to_money
         | 
| 77 | 
            +
                => "един лев и петдесет стотинки"
         | 
| 78 | 
            +
                
         | 
| 79 | 
            +
                1.53.to_money
         | 
| 80 | 
            +
                => "един лев и петдесет и три стотинки"
         | 
| 81 | 
            +
             | 
| 82 | 
            +
            ## Contributing
         | 
| 83 | 
            +
             | 
| 84 | 
            +
            1. Fork it
         | 
| 85 | 
            +
            2. Create your feature branch (`git checkout -b my-new-feature`)
         | 
| 86 | 
            +
            3. Commit your changes (`git commit -am 'Add some feature'`)
         | 
| 87 | 
            +
            4. Push to the branch (`git push origin my-new-feature`)
         | 
| 88 | 
            +
            5. Create a new Pull Request
         | 
    
        data/Rakefile
    ADDED
    
    
| @@ -0,0 +1,103 @@ | |
| 1 | 
            +
            require 'pry'
         | 
| 2 | 
            +
            module MoneyInWords
         | 
| 3 | 
            +
              class Integer
         | 
| 4 | 
            +
             | 
| 5 | 
            +
                SEPARATOR = ' и '
         | 
| 6 | 
            +
                ONES  = {
         | 
| 7 | 
            +
                  male:   %w(нула един два три четири пет шест седем осем девет),
         | 
| 8 | 
            +
                  female: %w(нула една две три четири пет шест седем осем девет),
         | 
| 9 | 
            +
                  neuter: %w(нула едно две три четири пет шест седем осем девет)
         | 
| 10 | 
            +
                }
         | 
| 11 | 
            +
                TEENS    = %w(десет единадесет дванадесет тринадесет четиринадесет петнадесет шестнадесет седемнадесет осемнадесет деветнадесет)
         | 
| 12 | 
            +
             | 
| 13 | 
            +
                TENS     = %w(_ _ двадесет тридесет четиридесет петдесет шестдесет седемдесет осемдесет деветдесет)
         | 
| 14 | 
            +
                HUNDREDS = %W(#{""} сто двеста триста четиристотин петстотин шестстоин седемстотин осемстотин деветстотин)
         | 
| 15 | 
            +
             | 
| 16 | 
            +
                def initialize(num, options={})
         | 
| 17 | 
            +
                  @num = num
         | 
| 18 | 
            +
                  @options = options
         | 
| 19 | 
            +
                  @article = options[:article] || :male
         | 
| 20 | 
            +
                end
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                def to_words
         | 
| 23 | 
            +
                  groups = split_number(@num)
         | 
| 24 | 
            +
                  groups.map!{ |h| numerize(h) }
         | 
| 25 | 
            +
                  groups = mega(groups)
         | 
| 26 | 
            +
                  groups.reject!(&:blank?)
         | 
| 27 | 
            +
                  groups = mega_join(groups)
         | 
| 28 | 
            +
                  groups.strip
         | 
| 29 | 
            +
                end
         | 
| 30 | 
            +
             | 
| 31 | 
            +
                def padleft!(a, n, x)
         | 
| 32 | 
            +
                  a.insert(0, *Array.new([0, n-a.length].max, x))
         | 
| 33 | 
            +
                end
         | 
| 34 | 
            +
             | 
| 35 | 
            +
                def split_number(num)
         | 
| 36 | 
            +
                  num.to_i.to_s.split(//).map(&:to_i).reverse.each_slice(3).to_a.map(&:reverse).reverse
         | 
| 37 | 
            +
                end
         | 
| 38 | 
            +
             | 
| 39 | 
            +
                def numerize(triple)
         | 
| 40 | 
            +
                  hun, ten, one = padleft!(triple, 3, 0)
         | 
| 41 | 
            +
                  num = []
         | 
| 42 | 
            +
                  num << HUNDREDS[hun] if hun > 0
         | 
| 43 | 
            +
             | 
| 44 | 
            +
                  case ten
         | 
| 45 | 
            +
                  when 0
         | 
| 46 | 
            +
                    num << ONES[@article][one] if one != 0
         | 
| 47 | 
            +
                  when 1
         | 
| 48 | 
            +
                    num << TEENS[one]
         | 
| 49 | 
            +
                  else
         | 
| 50 | 
            +
                    num << TENS[ten]
         | 
| 51 | 
            +
                    num << ONES[@article][one] if one != 0
         | 
| 52 | 
            +
                  end
         | 
| 53 | 
            +
                  njoin(num)
         | 
| 54 | 
            +
                end
         | 
| 55 | 
            +
             | 
| 56 | 
            +
                def mega(nums)
         | 
| 57 | 
            +
                  mega = %W(#{""} хиляди милионa милиарда)
         | 
| 58 | 
            +
             | 
| 59 | 
            +
                  nums.each_with_index.map do |num, i|
         | 
| 60 | 
            +
                    place = nums.length - i - 1
         | 
| 61 | 
            +
             | 
| 62 | 
            +
                    # Две хиляди, не два хиляди
         | 
| 63 | 
            +
                    num = 'две' if num == 'два' && place == 1
         | 
| 64 | 
            +
             | 
| 65 | 
            +
                    num = ONES[@article][0] if num == '' && place == 0 && nums.count == 1
         | 
| 66 | 
            +
             | 
| 67 | 
            +
                    if num == ONES[@article][1] && place == 1
         | 
| 68 | 
            +
                      'хиляда'
         | 
| 69 | 
            +
                    else
         | 
| 70 | 
            +
                      "#{num} #{mega[place]}"
         | 
| 71 | 
            +
                    end
         | 
| 72 | 
            +
                  end
         | 
| 73 | 
            +
                end
         | 
| 74 | 
            +
             | 
| 75 | 
            +
                def mega_join(arr, separator=SEPARATOR)
         | 
| 76 | 
            +
                  case arr.length
         | 
| 77 | 
            +
                  when 0
         | 
| 78 | 
            +
                    ''
         | 
| 79 | 
            +
                  when 1
         | 
| 80 | 
            +
                    arr.first
         | 
| 81 | 
            +
                  else
         | 
| 82 | 
            +
                    if arr.last.include?(SEPARATOR)
         | 
| 83 | 
            +
                      arr.join(" ")
         | 
| 84 | 
            +
                    else
         | 
| 85 | 
            +
                      arr[0...-1].join(" ") + separator + arr.last.to_s
         | 
| 86 | 
            +
                    end
         | 
| 87 | 
            +
                  end
         | 
| 88 | 
            +
             | 
| 89 | 
            +
                end
         | 
| 90 | 
            +
             | 
| 91 | 
            +
                def njoin(num, separator=SEPARATOR)
         | 
| 92 | 
            +
                  case num.length
         | 
| 93 | 
            +
                  when 0
         | 
| 94 | 
            +
                    ''
         | 
| 95 | 
            +
                  when 1
         | 
| 96 | 
            +
                    num.first
         | 
| 97 | 
            +
                  else
         | 
| 98 | 
            +
                    num[0...-1].join(" ") + separator + num.last.to_s
         | 
| 99 | 
            +
                  end
         | 
| 100 | 
            +
                end
         | 
| 101 | 
            +
             | 
| 102 | 
            +
              end
         | 
| 103 | 
            +
            end
         | 
| @@ -0,0 +1,76 @@ | |
| 1 | 
            +
            module MoneyInWords
         | 
| 2 | 
            +
              class Money
         | 
| 3 | 
            +
             | 
| 4 | 
            +
                attr_accessor :levs, :stotinki
         | 
| 5 | 
            +
             | 
| 6 | 
            +
                LEVS = {
         | 
| 7 | 
            +
                  zero: 'лева',
         | 
| 8 | 
            +
                  one: 'лев',
         | 
| 9 | 
            +
                  many: 'лева'
         | 
| 10 | 
            +
                }
         | 
| 11 | 
            +
             | 
| 12 | 
            +
                STOTINKI = {
         | 
| 13 | 
            +
                  zero: 'стотинки',
         | 
| 14 | 
            +
                  one: 'стотинка',
         | 
| 15 | 
            +
                  many: 'стотинки'
         | 
| 16 | 
            +
                }
         | 
| 17 | 
            +
             | 
| 18 | 
            +
                def initialize(num, options={})
         | 
| 19 | 
            +
                  @num = num
         | 
| 20 | 
            +
                  @levs, @stotinki = split_number
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                  @levs = @levs.to_i
         | 
| 23 | 
            +
                  @stotinki = @stotinki.ljust(2, '0').to_i
         | 
| 24 | 
            +
             | 
| 25 | 
            +
                  @options = {
         | 
| 26 | 
            +
                    show_zero_leva: true,
         | 
| 27 | 
            +
                    show_zero_stotinki: false
         | 
| 28 | 
            +
                  }.merge(options)
         | 
| 29 | 
            +
                end
         | 
| 30 | 
            +
             | 
| 31 | 
            +
                def to_words
         | 
| 32 | 
            +
                  [leva_to_words, stotinki_to_words].compact.join(" и ")
         | 
| 33 | 
            +
                end
         | 
| 34 | 
            +
             | 
| 35 | 
            +
                def split_number
         | 
| 36 | 
            +
                  @num.to_s.split(".")
         | 
| 37 | 
            +
                end
         | 
| 38 | 
            +
             | 
| 39 | 
            +
                def levs_suffix
         | 
| 40 | 
            +
                  if @levs == 0
         | 
| 41 | 
            +
                    LEVS[:zero]
         | 
| 42 | 
            +
                  elsif @levs == 1
         | 
| 43 | 
            +
                    LEVS[:one]
         | 
| 44 | 
            +
                  else
         | 
| 45 | 
            +
                    LEVS[:many]
         | 
| 46 | 
            +
                  end
         | 
| 47 | 
            +
                end
         | 
| 48 | 
            +
             | 
| 49 | 
            +
                def stotinki_suffix
         | 
| 50 | 
            +
                  if @stotinki == 0
         | 
| 51 | 
            +
                    STOTINKI[:zero]
         | 
| 52 | 
            +
                  elsif @stotinki == 1
         | 
| 53 | 
            +
                    STOTINKI[:one]
         | 
| 54 | 
            +
                  else
         | 
| 55 | 
            +
                    STOTINKI[:many]
         | 
| 56 | 
            +
                  end
         | 
| 57 | 
            +
                end
         | 
| 58 | 
            +
             | 
| 59 | 
            +
                def leva_to_words
         | 
| 60 | 
            +
                  if @levs == 0 && !@options[:show_zero_leva]
         | 
| 61 | 
            +
                    nil
         | 
| 62 | 
            +
                  else
         | 
| 63 | 
            +
                    @levs.to_words + " " + levs_suffix
         | 
| 64 | 
            +
                  end
         | 
| 65 | 
            +
                end
         | 
| 66 | 
            +
             | 
| 67 | 
            +
                def stotinki_to_words
         | 
| 68 | 
            +
                  if @stotinki == 0 && !@options[:show_zero_stotinki]
         | 
| 69 | 
            +
                    nil
         | 
| 70 | 
            +
                  else
         | 
| 71 | 
            +
                    @stotinki.to_words(article: :female) + " " + stotinki_suffix
         | 
| 72 | 
            +
                  end
         | 
| 73 | 
            +
                end
         | 
| 74 | 
            +
             | 
| 75 | 
            +
              end
         | 
| 76 | 
            +
            end
         | 
| @@ -0,0 +1,39 @@ | |
| 1 | 
            +
            require "money_in_words/integer"
         | 
| 2 | 
            +
            # require "money_in_words/float"
         | 
| 3 | 
            +
            require "money_in_words/money"
         | 
| 4 | 
            +
            require "money_in_words/core_ext/integer"
         | 
| 5 | 
            +
            require "money_in_words/core_ext/float"
         | 
| 6 | 
            +
            require "money_in_words/version"
         | 
| 7 | 
            +
             | 
| 8 | 
            +
            module MoneyInWords
         | 
| 9 | 
            +
             | 
| 10 | 
            +
              def self.to_words(num)
         | 
| 11 | 
            +
                case num
         | 
| 12 | 
            +
                when Integer
         | 
| 13 | 
            +
                  MoneyInWords::Integer.new(num).to_words
         | 
| 14 | 
            +
                when Float
         | 
| 15 | 
            +
                  MoneyInWords::Float.new(num).to_words
         | 
| 16 | 
            +
                end
         | 
| 17 | 
            +
              end
         | 
| 18 | 
            +
             | 
| 19 | 
            +
            end
         | 
| 20 | 
            +
             | 
| 21 | 
            +
            class String
         | 
| 22 | 
            +
              BLANK_RE = /\A[[:space:]]*\z/
         | 
| 23 | 
            +
             | 
| 24 | 
            +
              # A string is blank if it's empty or contains whitespaces only:
         | 
| 25 | 
            +
              #
         | 
| 26 | 
            +
              # ''.blank? # => true
         | 
| 27 | 
            +
              # ' '.blank? # => true
         | 
| 28 | 
            +
              # "\t\n\r".blank? # => true
         | 
| 29 | 
            +
              # ' blah '.blank? # => false
         | 
| 30 | 
            +
              #
         | 
| 31 | 
            +
              # Unicode whitespace is supported:
         | 
| 32 | 
            +
              #
         | 
| 33 | 
            +
              # "\u00a0".blank? # => true
         | 
| 34 | 
            +
              #
         | 
| 35 | 
            +
              # @return [true, false]
         | 
| 36 | 
            +
              def blank?
         | 
| 37 | 
            +
                BLANK_RE === self
         | 
| 38 | 
            +
              end
         | 
| 39 | 
            +
            end
         | 
| @@ -0,0 +1,25 @@ | |
| 1 | 
            +
            # coding: utf-8
         | 
| 2 | 
            +
            lib = File.expand_path('../lib', __FILE__)
         | 
| 3 | 
            +
            $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
         | 
| 4 | 
            +
            require 'money_in_words/version'
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            Gem::Specification.new do |spec|
         | 
| 7 | 
            +
              spec.name          = "money_in_words"
         | 
| 8 | 
            +
              spec.version       = MoneyInWords::VERSION
         | 
| 9 | 
            +
              spec.authors       = ["gmitrev"]
         | 
| 10 | 
            +
              spec.email         = ["gvmitrev@gmail.com"]
         | 
| 11 | 
            +
              spec.summary       = %q{Convert money in words}
         | 
| 12 | 
            +
              spec.description   = %q{}
         | 
| 13 | 
            +
              spec.homepage      = ""
         | 
| 14 | 
            +
              spec.license       = "MIT"
         | 
| 15 | 
            +
             | 
| 16 | 
            +
              spec.files         = `git ls-files -z`.split("\x0")
         | 
| 17 | 
            +
              spec.executables   = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
         | 
| 18 | 
            +
              spec.test_files    = spec.files.grep(%r{^(test|spec|features)/})
         | 
| 19 | 
            +
              spec.require_paths = ["lib"]
         | 
| 20 | 
            +
             | 
| 21 | 
            +
              spec.add_development_dependency "bundler", "~> 1.6"
         | 
| 22 | 
            +
              spec.add_development_dependency "rake", "~> 10.0"
         | 
| 23 | 
            +
              spec.add_development_dependency "rspec"
         | 
| 24 | 
            +
              spec.add_development_dependency "pry"
         | 
| 25 | 
            +
            end
         | 
    
        data/scratchpad.rb
    ADDED
    
    | @@ -0,0 +1,223 @@ | |
| 1 | 
            +
            num = 414.92
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            def num_to_words num
         | 
| 4 | 
            +
             | 
| 5 | 
            +
              currency = {
         | 
| 6 | 
            +
                zero: "лева",
         | 
| 7 | 
            +
                one: 'лев',
         | 
| 8 | 
            +
                many: 'лева'
         | 
| 9 | 
            +
              }
         | 
| 10 | 
            +
             | 
| 11 | 
            +
              levs = num.to_i
         | 
| 12 | 
            +
              stotinki = (num % 1).round(2)
         | 
| 13 | 
            +
             | 
| 14 | 
            +
              base = %w(нула един два три четири пет шест седем осем девет)
         | 
| 15 | 
            +
              teens = %w(десет единадесет дванадесет тринадесет четиринадесет петнадесет шестнадесет седемнадесет осемнадесет)
         | 
| 16 | 
            +
              tens = %w(десет двадесет тридесет четиридесет петдесет шестдесет седемдесет осемдесет деветдесет)
         | 
| 17 | 
            +
              hundreds = %w(сто двеста триста четиристотин петстотин шестстоин седемстотин осемстотин деветстотин)
         | 
| 18 | 
            +
              thousands = {
         | 
| 19 | 
            +
                one: "хиляда",
         | 
| 20 | 
            +
                many: 'хиляди'
         | 
| 21 | 
            +
              }
         | 
| 22 | 
            +
              millions = {
         | 
| 23 | 
            +
                one: "милион",
         | 
| 24 | 
            +
                many: 'милиона'
         | 
| 25 | 
            +
              }
         | 
| 26 | 
            +
              d = %w(хиляда, милион, милиард, билион)
         | 
| 27 | 
            +
             | 
| 28 | 
            +
             | 
| 29 | 
            +
             | 
| 30 | 
            +
              levs.to_s.split(//)
         | 
| 31 | 
            +
            end
         | 
| 32 | 
            +
             | 
| 33 | 
            +
             | 
| 34 | 
            +
            class String
         | 
| 35 | 
            +
              BLANK_RE = /\A[[:space:]]*\z/
         | 
| 36 | 
            +
             | 
| 37 | 
            +
              # A string is blank if it's empty or contains whitespaces only:
         | 
| 38 | 
            +
              #
         | 
| 39 | 
            +
              # ''.blank? # => true
         | 
| 40 | 
            +
              # ' '.blank? # => true
         | 
| 41 | 
            +
              # "\t\n\r".blank? # => true
         | 
| 42 | 
            +
              # ' blah '.blank? # => false
         | 
| 43 | 
            +
              #
         | 
| 44 | 
            +
              # Unicode whitespace is supported:
         | 
| 45 | 
            +
              #
         | 
| 46 | 
            +
              # "\u00a0".blank? # => true
         | 
| 47 | 
            +
              #
         | 
| 48 | 
            +
              # @return [true, false]
         | 
| 49 | 
            +
              def blank?
         | 
| 50 | 
            +
                BLANK_RE === self
         | 
| 51 | 
            +
              end
         | 
| 52 | 
            +
            end
         | 
| 53 | 
            +
             | 
| 54 | 
            +
             | 
| 55 | 
            +
            split_number(1_000_000.0)
         | 
| 56 | 
            +
             | 
| 57 | 
            +
            def padleft!(a, n, x)
         | 
| 58 | 
            +
              a.insert(0, *Array.new([0, n-a.length].max, x))
         | 
| 59 | 
            +
            end
         | 
| 60 | 
            +
            def padright!(a, n, x)
         | 
| 61 | 
            +
              a.fill(x, a.length...n)
         | 
| 62 | 
            +
            end
         | 
| 63 | 
            +
             | 
| 64 | 
            +
             | 
| 65 | 
            +
            def split_number(num)
         | 
| 66 | 
            +
              num.to_i.to_s.split(//).map(&:to_i).reverse.each_slice(3).to_a.map(&:reverse).reverse
         | 
| 67 | 
            +
            end
         | 
| 68 | 
            +
             | 
| 69 | 
            +
             | 
| 70 | 
            +
            def numerize(triple)
         | 
| 71 | 
            +
              base     = %w(нула един два три четири пет шест седем осем девет)
         | 
| 72 | 
            +
              teens    = %w(десет единадесет дванадесет тринадесет четиринадесет петнадесет шестнадесет седемнадесет осемнадесет деветнадесет)
         | 
| 73 | 
            +
             | 
| 74 | 
            +
              tens     = %w(_ _ двадесет тридесет четиридесет петдесет шестдесет седемдесет осемдесет деветдесет)
         | 
| 75 | 
            +
              hundreds = %w(_ сто двеста триста четиристотин петстотин шестстоин седемстотин осемстотин деветстотин)
         | 
| 76 | 
            +
                base[triple.first]
         | 
| 77 | 
            +
              separator = ' и '
         | 
| 78 | 
            +
             | 
| 79 | 
            +
              case triple.size
         | 
| 80 | 
            +
              when 1
         | 
| 81 | 
            +
                base[triple.last]
         | 
| 82 | 
            +
              when 2
         | 
| 83 | 
            +
                case triple.first
         | 
| 84 | 
            +
                when 0
         | 
| 85 | 
            +
                  base[triple.last]
         | 
| 86 | 
            +
                when 1
         | 
| 87 | 
            +
                  teens[triple.last]
         | 
| 88 | 
            +
                else
         | 
| 89 | 
            +
                  if triple.last == 0
         | 
| 90 | 
            +
                    tens[triple.first]
         | 
| 91 | 
            +
                  else
         | 
| 92 | 
            +
                    tens[triple.first] + separator + ones(triple.last)
         | 
| 93 | 
            +
                  end
         | 
| 94 | 
            +
                end
         | 
| 95 | 
            +
              when 3
         | 
| 96 | 
            +
                return hundreds[triple.first] if triple.drop(1) == [0,0]
         | 
| 97 | 
            +
             | 
| 98 | 
            +
                case triple[1]
         | 
| 99 | 
            +
                when *[0,1]
         | 
| 100 | 
            +
                  hundreds[triple.first] + separator + numerize(triple.drop(1))
         | 
| 101 | 
            +
                else
         | 
| 102 | 
            +
                  hundreds[triple.first] + " " + numerize(triple.drop(1))
         | 
| 103 | 
            +
                end
         | 
| 104 | 
            +
              end
         | 
| 105 | 
            +
             | 
| 106 | 
            +
            end
         | 
| 107 | 
            +
             | 
| 108 | 
            +
            def njoin(num, separator=' и ')
         | 
| 109 | 
            +
              case num.length
         | 
| 110 | 
            +
              when 0
         | 
| 111 | 
            +
                ''
         | 
| 112 | 
            +
              when 1
         | 
| 113 | 
            +
                num.first
         | 
| 114 | 
            +
              else
         | 
| 115 | 
            +
                num[0...-1].join(" ") + separator + num.last.to_s
         | 
| 116 | 
            +
              end
         | 
| 117 | 
            +
            end
         | 
| 118 | 
            +
            njoin [1,2,3]
         | 
| 119 | 
            +
             | 
| 120 | 
            +
            def numerize2(triple)
         | 
| 121 | 
            +
              ones     = %w(нула един два три четири пет шест седем осем девет)
         | 
| 122 | 
            +
              teens    = %w(десет единадесет дванадесет тринадесет четиринадесет петнадесет шестнадесет седемнадесет осемнадесет деветнадесет)
         | 
| 123 | 
            +
             | 
| 124 | 
            +
              tens     = %w(_ _ двадесет тридесет четиридесет петдесет шестдесет седемдесет осемдесет деветдесет)
         | 
| 125 | 
            +
              hundreds = %W(#{""} сто двеста триста четиристотин петстотин шестстоин седемстотин осемстотин деветстотин)
         | 
| 126 | 
            +
             | 
| 127 | 
            +
              hun, ten, one = padleft!(triple, 3, 0)
         | 
| 128 | 
            +
              num = []
         | 
| 129 | 
            +
              num << hundreds[hun] if hun > 0
         | 
| 130 | 
            +
             | 
| 131 | 
            +
              case ten
         | 
| 132 | 
            +
              when 0
         | 
| 133 | 
            +
                num << ones[one] if one != 0
         | 
| 134 | 
            +
              when 1
         | 
| 135 | 
            +
                num << teens[one]
         | 
| 136 | 
            +
              else
         | 
| 137 | 
            +
                num << tens[ten]
         | 
| 138 | 
            +
                num << ones[one] if one != 0
         | 
| 139 | 
            +
              end
         | 
| 140 | 
            +
              njoin(num)
         | 
| 141 | 
            +
            end
         | 
| 142 | 
            +
             | 
| 143 | 
            +
            numerize2([1,0,0])
         | 
| 144 | 
            +
            numerize2([3,3,0])
         | 
| 145 | 
            +
            numerize2([0,1,1])
         | 
| 146 | 
            +
            numerize2([0,0,1])
         | 
| 147 | 
            +
            numerize2([0,6,1])
         | 
| 148 | 
            +
             | 
| 149 | 
            +
            def mega(nums)
         | 
| 150 | 
            +
              mega = %W(#{""} хиляди милионa милиарда)
         | 
| 151 | 
            +
             | 
| 152 | 
            +
              nums.each_with_index.map do |num, i|
         | 
| 153 | 
            +
                place = nums.length - i - 1
         | 
| 154 | 
            +
             | 
| 155 | 
            +
                # Две хиляди, не два хиляди
         | 
| 156 | 
            +
                num = 'две' if num == 'два' && place == 1
         | 
| 157 | 
            +
                if num == 'един' && place == 1
         | 
| 158 | 
            +
                'хиляда'
         | 
| 159 | 
            +
                else
         | 
| 160 | 
            +
                  "#{num} #{mega[place]}"
         | 
| 161 | 
            +
                end
         | 
| 162 | 
            +
              end
         | 
| 163 | 
            +
            end
         | 
| 164 | 
            +
             | 
| 165 | 
            +
            def join2(arr, separator=' и ')
         | 
| 166 | 
            +
              case arr.length
         | 
| 167 | 
            +
              when 0
         | 
| 168 | 
            +
                ''
         | 
| 169 | 
            +
              when 1
         | 
| 170 | 
            +
                arr.first
         | 
| 171 | 
            +
              else
         | 
| 172 | 
            +
                if arr.last.include?(" и ")
         | 
| 173 | 
            +
                  arr.join(" ")
         | 
| 174 | 
            +
                else
         | 
| 175 | 
            +
                  arr[0...-1].join(" ") + separator + arr.last.to_s
         | 
| 176 | 
            +
                end
         | 
| 177 | 
            +
              end
         | 
| 178 | 
            +
             | 
| 179 | 
            +
            end
         | 
| 180 | 
            +
             | 
| 181 | 
            +
            mega(["двадесет", "сто"])
         | 
| 182 | 
            +
            mega(["триста", "двадесет", "сто"])
         | 
| 183 | 
            +
            join2 mega(["седем", "триста", "двадесет", "сто и седем"])
         | 
| 184 | 
            +
             | 
| 185 | 
            +
            def wololo(num)
         | 
| 186 | 
            +
              groups = split_number(num)
         | 
| 187 | 
            +
              groups.map!{ |h| numerize2(h) }
         | 
| 188 | 
            +
              groups = mega(groups)
         | 
| 189 | 
            +
              groups.reject!(&:blank?)
         | 
| 190 | 
            +
              groups = join2(groups)
         | 
| 191 | 
            +
            end
         | 
| 192 | 
            +
             | 
| 193 | 
            +
            wololo(1231)
         | 
| 194 | 
            +
             | 
| 195 | 
            +
            wololo(5)
         | 
| 196 | 
            +
            wololo(15)
         | 
| 197 | 
            +
            wololo(20)
         | 
| 198 | 
            +
            wololo(35)
         | 
| 199 | 
            +
            wololo(77)
         | 
| 200 | 
            +
            wololo(100)
         | 
| 201 | 
            +
            wololo(101)
         | 
| 202 | 
            +
            wololo(111)
         | 
| 203 | 
            +
            wololo(121)
         | 
| 204 | 
            +
            wololo(2000)
         | 
| 205 | 
            +
             | 
| 206 | 
            +
             | 
| 207 | 
            +
            0.to_money
         | 
| 208 | 
            +
            0.5.to_money
         | 
| 209 | 
            +
            0.5.to_money(show_zero_leva: false)
         | 
| 210 | 
            +
            1.to_money
         | 
| 211 | 
            +
            1.to_money(show_zero_stotinki: true)
         | 
| 212 | 
            +
            1.01.to_money
         | 
| 213 | 
            +
            1.5.to_money
         | 
| 214 | 
            +
            1.53.to_money
         | 
| 215 | 
            +
             | 
| 216 | 
            +
            0.to_words
         | 
| 217 | 
            +
            1.to_words
         | 
| 218 | 
            +
            1.to_words(article: :neuter)
         | 
| 219 | 
            +
            1.to_words(article: :female)
         | 
| 220 | 
            +
            11.to_words
         | 
| 221 | 
            +
            33.to_words
         | 
| 222 | 
            +
            2000.to_words
         | 
| 223 | 
            +
            2001.to_words
         | 
| @@ -0,0 +1,152 @@ | |
| 1 | 
            +
            require 'spec_helper'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            describe 'Money in Words' do
         | 
| 4 | 
            +
             | 
| 5 | 
            +
              describe "Integers" do
         | 
| 6 | 
            +
             | 
| 7 | 
            +
                describe 'Male' do
         | 
| 8 | 
            +
                  FIXTURES = [
         | 
| 9 | 
            +
                    [0, 'нула'],
         | 
| 10 | 
            +
                    [1, 'един'],
         | 
| 11 | 
            +
                    [2, 'два'],
         | 
| 12 | 
            +
                    [3, 'три'],
         | 
| 13 | 
            +
                    [4, 'четири'],
         | 
| 14 | 
            +
                    [5, 'пет'],
         | 
| 15 | 
            +
                    [6, 'шест'],
         | 
| 16 | 
            +
                    [7, 'седем'],
         | 
| 17 | 
            +
                    [8, 'осем'],
         | 
| 18 | 
            +
                    [9, 'девет'],
         | 
| 19 | 
            +
                    [10, 'десет'],
         | 
| 20 | 
            +
                    [11, 'единадесет'],
         | 
| 21 | 
            +
                    [12, 'дванадесет'],
         | 
| 22 | 
            +
                    [13, 'тринадесет'],
         | 
| 23 | 
            +
                    [14, 'четиринадесет'],
         | 
| 24 | 
            +
                    [15, 'петнадесет'],
         | 
| 25 | 
            +
                    [16, 'шестнадесет'],
         | 
| 26 | 
            +
                    [17, 'седемнадесет'],
         | 
| 27 | 
            +
                    [18, 'осемнадесет'],
         | 
| 28 | 
            +
                    [19, 'деветнадесет'],
         | 
| 29 | 
            +
                    [20, 'двадесет'],
         | 
| 30 | 
            +
                    [22, 'двадесет и два'],
         | 
| 31 | 
            +
                    [30, 'тридесет'],
         | 
| 32 | 
            +
                    [60, 'шестдесет'],
         | 
| 33 | 
            +
                    [66, 'шестдесет и шест'],
         | 
| 34 | 
            +
                    [99, 'деветдесет и девет'],
         | 
| 35 | 
            +
                    [100, 'сто'],
         | 
| 36 | 
            +
                    [101, 'сто и един'],
         | 
| 37 | 
            +
                    [112, 'сто и дванадесет'],
         | 
| 38 | 
            +
                    [120, 'сто и двадесет'],
         | 
| 39 | 
            +
                    [123, 'сто двадесет и три'],
         | 
| 40 | 
            +
                    [223, 'двеста двадесет и три'],
         | 
| 41 | 
            +
                    [1000, 'хиляда'],
         | 
| 42 | 
            +
                    [1001, 'хиляда и един'],
         | 
| 43 | 
            +
                    [1010, 'хиляда и десет'],
         | 
| 44 | 
            +
                    [1011, 'хиляда и единадесет'],
         | 
| 45 | 
            +
                    [1100, 'хиляда и сто'],
         | 
| 46 | 
            +
                    [1101, 'хиляда сто и един'],
         | 
| 47 | 
            +
                    [1111, 'хиляда сто и единадесет'],
         | 
| 48 | 
            +
                    [1126, 'хиляда сто двадесет и шест'],
         | 
| 49 | 
            +
                    [2000, 'две хиляди'],
         | 
| 50 | 
            +
                    [2500, 'две хиляди и петстотин'],
         | 
| 51 | 
            +
                  ]
         | 
| 52 | 
            +
             | 
| 53 | 
            +
                  FIXTURES.each do |f|
         | 
| 54 | 
            +
                    it "male example #{f.first} " do
         | 
| 55 | 
            +
                      expect(f.first.to_words).to eq f.last
         | 
| 56 | 
            +
                    end
         | 
| 57 | 
            +
                  end
         | 
| 58 | 
            +
                end
         | 
| 59 | 
            +
             | 
| 60 | 
            +
                describe 'Female' do
         | 
| 61 | 
            +
                  FIXTURES = [
         | 
| 62 | 
            +
                    [0, 'нула'],
         | 
| 63 | 
            +
                    [1, 'една'],
         | 
| 64 | 
            +
                    [2, 'две'],
         | 
| 65 | 
            +
                    [3, 'три'],
         | 
| 66 | 
            +
                    [4, 'четири'],
         | 
| 67 | 
            +
                    [5, 'пет'],
         | 
| 68 | 
            +
                    [6, 'шест'],
         | 
| 69 | 
            +
                    [7, 'седем'],
         | 
| 70 | 
            +
                    [8, 'осем'],
         | 
| 71 | 
            +
                    [9, 'девет'],
         | 
| 72 | 
            +
                    [10, 'десет'],
         | 
| 73 | 
            +
                    [11, 'единадесет'],
         | 
| 74 | 
            +
                    [12, 'дванадесет'],
         | 
| 75 | 
            +
                    [13, 'тринадесет'],
         | 
| 76 | 
            +
                    [14, 'четиринадесет'],
         | 
| 77 | 
            +
                    [15, 'петнадесет'],
         | 
| 78 | 
            +
                    [16, 'шестнадесет'],
         | 
| 79 | 
            +
                    [17, 'седемнадесет'],
         | 
| 80 | 
            +
                    [18, 'осемнадесет'],
         | 
| 81 | 
            +
                    [19, 'деветнадесет'],
         | 
| 82 | 
            +
                    [20, 'двадесет'],
         | 
| 83 | 
            +
                    [22, 'двадесет и две'],
         | 
| 84 | 
            +
                    [30, 'тридесет'],
         | 
| 85 | 
            +
                    [60, 'шестдесет'],
         | 
| 86 | 
            +
                    [66, 'шестдесет и шест'],
         | 
| 87 | 
            +
                    [99, 'деветдесет и девет'],
         | 
| 88 | 
            +
                    [100, 'сто'],
         | 
| 89 | 
            +
                    [101, 'сто и една'],
         | 
| 90 | 
            +
                    [112, 'сто и дванадесет'],
         | 
| 91 | 
            +
                    [120, 'сто и двадесет'],
         | 
| 92 | 
            +
                    [123, 'сто двадесет и три'],
         | 
| 93 | 
            +
                    [223, 'двеста двадесет и три'],
         | 
| 94 | 
            +
                    [1000, 'хиляда'],
         | 
| 95 | 
            +
                    [1001, 'хиляда и една'],
         | 
| 96 | 
            +
                    [1010, 'хиляда и десет'],
         | 
| 97 | 
            +
                    [1011, 'хиляда и единадесет'],
         | 
| 98 | 
            +
                    [1100, 'хиляда и сто'],
         | 
| 99 | 
            +
                    [1101, 'хиляда сто и една'],
         | 
| 100 | 
            +
                    [1111, 'хиляда сто и единадесет'],
         | 
| 101 | 
            +
                    [1126, 'хиляда сто двадесет и шест'],
         | 
| 102 | 
            +
                    [2000, 'две хиляди'],
         | 
| 103 | 
            +
                    [2500, 'две хиляди и петстотин'],
         | 
| 104 | 
            +
                  ]
         | 
| 105 | 
            +
             | 
| 106 | 
            +
                  FIXTURES.each do |f|
         | 
| 107 | 
            +
                    it "female example #{f.first} " do
         | 
| 108 | 
            +
                      expect(f.first.to_words(article: :female)).to eq f.last
         | 
| 109 | 
            +
                    end
         | 
| 110 | 
            +
                  end
         | 
| 111 | 
            +
                end
         | 
| 112 | 
            +
             | 
| 113 | 
            +
              end
         | 
| 114 | 
            +
             | 
| 115 | 
            +
              describe "Money" do
         | 
| 116 | 
            +
             | 
| 117 | 
            +
                FIXTURES = [
         | 
| 118 | 
            +
                  [0, 'нула лева'],
         | 
| 119 | 
            +
                  [0.5, 'нула лева и петдесет стотинки'],
         | 
| 120 | 
            +
                  [1, 'един лев'],
         | 
| 121 | 
            +
                  [1.2, 'един лев и двадесет стотинки'],
         | 
| 122 | 
            +
                  [2.22, 'два лева и двадесет и две стотинки'],
         | 
| 123 | 
            +
                  [3.99, 'три лева и деветдесет и девет стотинки'],
         | 
| 124 | 
            +
                  [4.01, 'четири лева и една стотинка'],
         | 
| 125 | 
            +
                  [5.11, 'пет лева и единадесет стотинки'],
         | 
| 126 | 
            +
                  [2500.08, 'две хиляди и петстотин лева и осем стотинки'],
         | 
| 127 | 
            +
                ]
         | 
| 128 | 
            +
             | 
| 129 | 
            +
                FIXTURES.each do |f|
         | 
| 130 | 
            +
                  it "example #{f.first} " do
         | 
| 131 | 
            +
                    expect(f.first.to_money).to eq f.last
         | 
| 132 | 
            +
                  end
         | 
| 133 | 
            +
                end
         | 
| 134 | 
            +
             | 
| 135 | 
            +
                it "example 3 without stotinki" do
         | 
| 136 | 
            +
                  expect(3.to_money(show_zero_stotinki: false)).to eq "три лева"
         | 
| 137 | 
            +
                end
         | 
| 138 | 
            +
             | 
| 139 | 
            +
                it "example 3 with stotinki" do
         | 
| 140 | 
            +
                  expect(3.to_money(show_zero_stotinki: true)).to eq "три лева и нула стотинки"
         | 
| 141 | 
            +
                end
         | 
| 142 | 
            +
             | 
| 143 | 
            +
                it "example 0.50 with leva" do
         | 
| 144 | 
            +
                  expect(0.5.to_money(show_zero_leva: true)).to eq "нула лева и петдесет стотинки"
         | 
| 145 | 
            +
                end
         | 
| 146 | 
            +
             | 
| 147 | 
            +
                it "example 0.50 without leva" do
         | 
| 148 | 
            +
                  expect(0.5.to_money(show_zero_leva: false)).to eq "петдесет стотинки"
         | 
| 149 | 
            +
                end
         | 
| 150 | 
            +
             | 
| 151 | 
            +
              end
         | 
| 152 | 
            +
            end
         | 
    
        data/spec/spec_helper.rb
    ADDED
    
    | @@ -0,0 +1,15 @@ | |
| 1 | 
            +
            require 'bundler/setup'
         | 
| 2 | 
            +
            Bundler.setup
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            require 'money_in_words'
         | 
| 5 | 
            +
             | 
| 6 | 
            +
             | 
| 7 | 
            +
            RSpec.configure do |config|
         | 
| 8 | 
            +
              config.treat_symbols_as_metadata_keys_with_true_values = true
         | 
| 9 | 
            +
              config.run_all_when_everything_filtered = true
         | 
| 10 | 
            +
              config.filter_run :focus
         | 
| 11 | 
            +
              config.filter_run_excluding :brute
         | 
| 12 | 
            +
             | 
| 13 | 
            +
             | 
| 14 | 
            +
              config.order = 'random'
         | 
| 15 | 
            +
            end
         | 
    
        metadata
    ADDED
    
    | @@ -0,0 +1,117 @@ | |
| 1 | 
            +
            --- !ruby/object:Gem::Specification
         | 
| 2 | 
            +
            name: money_in_words
         | 
| 3 | 
            +
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            +
              version: 1.0.0
         | 
| 5 | 
            +
            platform: ruby
         | 
| 6 | 
            +
            authors:
         | 
| 7 | 
            +
            - gmitrev
         | 
| 8 | 
            +
            autorequire: 
         | 
| 9 | 
            +
            bindir: bin
         | 
| 10 | 
            +
            cert_chain: []
         | 
| 11 | 
            +
            date: 2014-08-11 00:00:00.000000000 Z
         | 
| 12 | 
            +
            dependencies:
         | 
| 13 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 14 | 
            +
              name: bundler
         | 
| 15 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 16 | 
            +
                requirements:
         | 
| 17 | 
            +
                - - "~>"
         | 
| 18 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 19 | 
            +
                    version: '1.6'
         | 
| 20 | 
            +
              type: :development
         | 
| 21 | 
            +
              prerelease: false
         | 
| 22 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 23 | 
            +
                requirements:
         | 
| 24 | 
            +
                - - "~>"
         | 
| 25 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 26 | 
            +
                    version: '1.6'
         | 
| 27 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 28 | 
            +
              name: rake
         | 
| 29 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 30 | 
            +
                requirements:
         | 
| 31 | 
            +
                - - "~>"
         | 
| 32 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 33 | 
            +
                    version: '10.0'
         | 
| 34 | 
            +
              type: :development
         | 
| 35 | 
            +
              prerelease: false
         | 
| 36 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 37 | 
            +
                requirements:
         | 
| 38 | 
            +
                - - "~>"
         | 
| 39 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 40 | 
            +
                    version: '10.0'
         | 
| 41 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 42 | 
            +
              name: rspec
         | 
| 43 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 44 | 
            +
                requirements:
         | 
| 45 | 
            +
                - - ">="
         | 
| 46 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 47 | 
            +
                    version: '0'
         | 
| 48 | 
            +
              type: :development
         | 
| 49 | 
            +
              prerelease: false
         | 
| 50 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 51 | 
            +
                requirements:
         | 
| 52 | 
            +
                - - ">="
         | 
| 53 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 54 | 
            +
                    version: '0'
         | 
| 55 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 56 | 
            +
              name: pry
         | 
| 57 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 58 | 
            +
                requirements:
         | 
| 59 | 
            +
                - - ">="
         | 
| 60 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 61 | 
            +
                    version: '0'
         | 
| 62 | 
            +
              type: :development
         | 
| 63 | 
            +
              prerelease: false
         | 
| 64 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 65 | 
            +
                requirements:
         | 
| 66 | 
            +
                - - ">="
         | 
| 67 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 68 | 
            +
                    version: '0'
         | 
| 69 | 
            +
            description: ''
         | 
| 70 | 
            +
            email:
         | 
| 71 | 
            +
            - gvmitrev@gmail.com
         | 
| 72 | 
            +
            executables: []
         | 
| 73 | 
            +
            extensions: []
         | 
| 74 | 
            +
            extra_rdoc_files: []
         | 
| 75 | 
            +
            files:
         | 
| 76 | 
            +
            - ".gitignore"
         | 
| 77 | 
            +
            - Gemfile
         | 
| 78 | 
            +
            - LICENSE.txt
         | 
| 79 | 
            +
            - README.md
         | 
| 80 | 
            +
            - Rakefile
         | 
| 81 | 
            +
            - lib/money_in_words.rb
         | 
| 82 | 
            +
            - lib/money_in_words/core_ext/float.rb
         | 
| 83 | 
            +
            - lib/money_in_words/core_ext/integer.rb
         | 
| 84 | 
            +
            - lib/money_in_words/integer.rb
         | 
| 85 | 
            +
            - lib/money_in_words/money.rb
         | 
| 86 | 
            +
            - lib/money_in_words/version.rb
         | 
| 87 | 
            +
            - money_in_words.gemspec
         | 
| 88 | 
            +
            - scratchpad.rb
         | 
| 89 | 
            +
            - spec/money_in_words_spec.rb
         | 
| 90 | 
            +
            - spec/spec_helper.rb
         | 
| 91 | 
            +
            homepage: ''
         | 
| 92 | 
            +
            licenses:
         | 
| 93 | 
            +
            - MIT
         | 
| 94 | 
            +
            metadata: {}
         | 
| 95 | 
            +
            post_install_message: 
         | 
| 96 | 
            +
            rdoc_options: []
         | 
| 97 | 
            +
            require_paths:
         | 
| 98 | 
            +
            - lib
         | 
| 99 | 
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         | 
| 100 | 
            +
              requirements:
         | 
| 101 | 
            +
              - - ">="
         | 
| 102 | 
            +
                - !ruby/object:Gem::Version
         | 
| 103 | 
            +
                  version: '0'
         | 
| 104 | 
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 105 | 
            +
              requirements:
         | 
| 106 | 
            +
              - - ">="
         | 
| 107 | 
            +
                - !ruby/object:Gem::Version
         | 
| 108 | 
            +
                  version: '0'
         | 
| 109 | 
            +
            requirements: []
         | 
| 110 | 
            +
            rubyforge_project: 
         | 
| 111 | 
            +
            rubygems_version: 2.2.2
         | 
| 112 | 
            +
            signing_key: 
         | 
| 113 | 
            +
            specification_version: 4
         | 
| 114 | 
            +
            summary: Convert money in words
         | 
| 115 | 
            +
            test_files:
         | 
| 116 | 
            +
            - spec/money_in_words_spec.rb
         | 
| 117 | 
            +
            - spec/spec_helper.rb
         |