numerology 0.0.2 → 0.0.3
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.
- data/features/numerology.feature +5 -1
- data/lib/numerology.rb +9 -2
- data/lib/numerology/version.rb +1 -1
- metadata +2 -2
    
        data/features/numerology.feature
    CHANGED
    
    | @@ -23,4 +23,8 @@ Feature: Formatting a number | |
| 23 23 | 
             
                  | 12345              | 01111              | 12345              |
         | 
| 24 24 | 
             
                  | 12345              | 01,111             | 12,345             |
         | 
| 25 25 | 
             
                  | 1234               | 01,111             | 01,234             |
         | 
| 26 | 
            -
                  | 123                | 01,111             | 00,123             |
         | 
| 26 | 
            +
                  | 123                | 01,111             | 00,123             |
         | 
| 27 | 
            +
                  | 123                | 100                | 100                |
         | 
| 28 | 
            +
                  | 12345              | 11000              | 12000              |
         | 
| 29 | 
            +
                  | 12345              | 11,000             | 12,000             |
         | 
| 30 | 
            +
                  | 15555              | 11,000             | 16,000             |
         | 
    
        data/lib/numerology.rb
    CHANGED
    
    | @@ -2,10 +2,17 @@ require "numerology/version" | |
| 2 2 |  | 
| 3 3 | 
             
            module Numerology
         | 
| 4 4 | 
             
              def format_like(example)
         | 
| 5 | 
            +
                if example.gsub(/\D/,'') =~ /(0+$)/
         | 
| 6 | 
            +
                  sig_fig = $1.length
         | 
| 7 | 
            +
                  temp = self.round(sig_fig*-1)
         | 
| 8 | 
            +
                else
         | 
| 9 | 
            +
                  temp = self
         | 
| 10 | 
            +
                end
         | 
| 11 | 
            +
             | 
| 5 12 | 
             
                if example =~ /^[0\s]/
         | 
| 6 | 
            -
                  formatted_string = "%#{example[0]}#{example.gsub(/\D/,'').length}d" %  | 
| 13 | 
            +
                  formatted_string = "%#{example[0]}#{example.gsub(/\D/,'').length}d" % temp 
         | 
| 7 14 | 
             
                else
         | 
| 8 | 
            -
                  formatted_string =  | 
| 15 | 
            +
                  formatted_string = temp.to_s
         | 
| 9 16 | 
             
                end
         | 
| 10 17 |  | 
| 11 18 | 
             
                formatted_string = separate_thousands(formatted_string, example[-4]) if example =~ /(\D)\d{3}$/
         | 
    
        data/lib/numerology/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: numerology
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.0. | 
| 4 | 
            +
              version: 0.0.3
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 6 | 
             
            platform: ruby
         | 
| 7 7 | 
             
            authors:
         | 
| @@ -9,7 +9,7 @@ authors: | |
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date: 2013- | 
| 12 | 
            +
            date: 2013-03-01 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: rake
         |