runby_pace 0.4.83 → 0.4.84
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 +8 -8
- data/lib/runby_pace/pace_units.rb +12 -30
- metadata +3 -3
    
        checksums.yaml
    CHANGED
    
    | @@ -1,15 +1,15 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            !binary "U0hBMQ==":
         | 
| 3 3 | 
             
              metadata.gz: !binary |-
         | 
| 4 | 
            -
                 | 
| 4 | 
            +
                Y2NlZWFiMjk5NDdjOTI2OWU1OGIyNjY2MzNhYzhmMzY0MjRlNGIzYg==
         | 
| 5 5 | 
             
              data.tar.gz: !binary |-
         | 
| 6 | 
            -
                 | 
| 6 | 
            +
                YjU5MDBjZDMwMTlhOTUyM2JmZTE3YzkzODk3NmY0OTA2MTk5ZDA4Yw==
         | 
| 7 7 | 
             
            SHA512:
         | 
| 8 8 | 
             
              metadata.gz: !binary |-
         | 
| 9 | 
            -
                 | 
| 10 | 
            -
                 | 
| 11 | 
            -
                 | 
| 9 | 
            +
                NWY2YzUzODBhMmExMTJlMjVmZmMzODdlYzZkNWEyNDUyMmQyM2Y0ZmQxM2Fk
         | 
| 10 | 
            +
                M2EwN2M0MGRhZjVmNzM4YmUzYjRmZTU5Zjg0NDc2M2NiMDhjYzM2ZTFjNDVh
         | 
| 11 | 
            +
                ZjYwOWI3ZDQ0OTE1ZTU0NTBhMjExYjAyZGE0MWRmYjJjZWFmYTE=
         | 
| 12 12 | 
             
              data.tar.gz: !binary |-
         | 
| 13 | 
            -
                 | 
| 14 | 
            -
                 | 
| 15 | 
            -
                 | 
| 13 | 
            +
                N2Y4M2QxZDI2YWI1ZjJkNDhhZGE1MGJmZTYzZDgzYzExNzFmMzliODhlMGVj
         | 
| 14 | 
            +
                N2Y3OTAxMDU5ZThmMGYxNGJiNzQxZWNlN2E4YjVjNGY2YTU3ODg5M2UzN2Y2
         | 
| 15 | 
            +
                OTQ1Y2IwMTZjZmI3NzI0NDg3MTdhNmI0YWUxNTllOTYyMGEwNmQ=
         | 
| @@ -13,52 +13,34 @@ module Runby | |
| 13 13 | 
             
                  found_uom_factor = 1
         | 
| 14 14 | 
             
                  @@_distance_uom_definition.each do |uom, details|
         | 
| 15 15 | 
             
                    if details[:synonyms].include? description
         | 
| 16 | 
            -
                       | 
| 17 | 
            -
                      break
         | 
| 18 | 
            -
                    end
         | 
| 19 | 
            -
                  end
         | 
| 20 | 
            -
                  if found_uom.nil?
         | 
| 21 | 
            -
                    # Search the special UOMs
         | 
| 22 | 
            -
                    @@_distance_uom_definition_special.each_value do |details|
         | 
| 23 | 
            -
                      if details[:synonyms].include? description
         | 
| 16 | 
            +
                      if details.has_key? :uom
         | 
| 24 17 | 
             
                        found_uom = details[:uom]
         | 
| 25 18 | 
             
                        found_uom_factor = details[:factor]
         | 
| 26 | 
            -
             | 
| 19 | 
            +
                      else
         | 
| 20 | 
            +
                        found_uom = uom
         | 
| 27 21 | 
             
                      end
         | 
| 22 | 
            +
                      break
         | 
| 28 23 | 
             
                    end
         | 
| 29 24 | 
             
                  end
         | 
| 30 25 | 
             
                  { uom: found_uom, factor: found_uom_factor }
         | 
| 31 26 | 
             
                end
         | 
| 32 27 |  | 
| 33 28 | 
             
                def self.distance_conversion_factor(units)
         | 
| 34 | 
            -
                   | 
| 29 | 
            +
                  @@_distance_uom_definition[units][:conversion_factor]
         | 
| 35 30 | 
             
                end
         | 
| 36 31 |  | 
| 37 32 | 
             
                def self.known_uom?(symbol)
         | 
| 38 33 | 
             
                  # TODO: test
         | 
| 39 | 
            -
                  @@_distance_uom_definition.has_key?(symbol) | 
| 34 | 
            +
                  @@_distance_uom_definition.has_key?(symbol)
         | 
| 40 35 | 
             
                end
         | 
| 41 36 |  | 
| 42 | 
            -
                ### -- Private class methods --
         | 
| 43 | 
            -
             | 
| 44 37 | 
             
                @@_distance_uom_definition =
         | 
| 45 | 
            -
                  { km: { description: 'Kilometer', synonyms: %w(k km kms kilometer kilometers) },
         | 
| 46 | 
            -
                    m:  { description: 'Meter', synonyms: %w(m meter meters) },
         | 
| 47 | 
            -
                    mi: { description: 'Mile', synonyms: %w(mi mile miles) },
         | 
| 48 | 
            -
                    ft: { description: 'Feet', synonyms: %w(ft foot feet) }
         | 
| 38 | 
            +
                  { km: { description: 'Kilometer', conversion_factor: 1.0, synonyms: %w(k km kms kilometer kilometers) },
         | 
| 39 | 
            +
                    m:  { description: 'Meter', conversion_factor: 0.001, synonyms: %w(m meter meters) },
         | 
| 40 | 
            +
                    mi: { description: 'Mile', conversion_factor: 1.609344, synonyms: %w(mi mile miles) },
         | 
| 41 | 
            +
                    ft: { description: 'Feet', conversion_factor: 0.0003048, synonyms: %w(ft foot feet) },
         | 
| 42 | 
            +
                    # Special UOMs, which just point to "real" UOMs in this hash table
         | 
| 43 | 
            +
                    marathon: { description: 'Marathon', uom: :mi, factor: 26.2, synonyms: %w(marathon), uom: :mi, factor: 26.2 }
         | 
| 49 44 | 
             
                  }
         | 
| 50 | 
            -
             | 
| 51 | 
            -
                @@_distance_uom_definition_special =
         | 
| 52 | 
            -
                {
         | 
| 53 | 
            -
                    marathon: { description: 'Marathon', uom: :mi, factor: 26.2, synonyms: %w(marathon) }
         | 
| 54 | 
            -
                }
         | 
| 55 | 
            -
             | 
| 56 | 
            -
                private_class_method
         | 
| 57 | 
            -
                def self.distance_conversion_factors
         | 
| 58 | 
            -
                  { km: 1.0,
         | 
| 59 | 
            -
                    m:  0.001,
         | 
| 60 | 
            -
                    mi: 1.609344,
         | 
| 61 | 
            -
                    ft: 0.0003048 }
         | 
| 62 | 
            -
                end
         | 
| 63 45 | 
             
              end
         | 
| 64 46 | 
             
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: runby_pace
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.4. | 
| 4 | 
            +
              version: 0.4.84
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Ty Walls
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2016-09- | 
| 11 | 
            +
            date: 2016-09-06 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: bundler
         | 
| @@ -99,7 +99,7 @@ homepage: https://github.com/tygerbytes/runby-pace | |
| 99 99 | 
             
            licenses:
         | 
| 100 100 | 
             
            - MIT
         | 
| 101 101 | 
             
            metadata:
         | 
| 102 | 
            -
              commit-hash:  | 
| 102 | 
            +
              commit-hash: 6d6a0922c203bcbe7e3e131623a70aea292fe071
         | 
| 103 103 | 
             
            post_install_message: 
         | 
| 104 104 | 
             
            rdoc_options: []
         | 
| 105 105 | 
             
            require_paths:
         |