pkp_physics 0.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/MIT-LICENSE +21 -0
- data/README.md +41 -0
- data/lib/pkp_physics.rb +68 -0
- data/test/test_pkp_physics.rb +32 -0
- metadata +47 -0
    
        checksums.yaml
    ADDED
    
    | @@ -0,0 +1,7 @@ | |
| 1 | 
            +
            ---
         | 
| 2 | 
            +
            SHA1:
         | 
| 3 | 
            +
              metadata.gz: 002ed12a80133bc14610c84bc4860c0e39c957dc
         | 
| 4 | 
            +
              data.tar.gz: 2fd045c9d464c86cbeaa429e478bb7fd5db97599
         | 
| 5 | 
            +
            SHA512:
         | 
| 6 | 
            +
              metadata.gz: f7ed7d93534d2b3f085133697b41c90942bef9e657681402264b7b8b6f598dd3a89501d6d87ca8d179a7052870009cc78f7726b1ecda7ca153d69f2ccece8ed9
         | 
| 7 | 
            +
              data.tar.gz: 7e625b876887ac91c27abf41cf9d4f1a8b02146e001deddd33905e4b3a9af172442b40291834d63423243147e4e27ef93c5546099727204a76d11f217be01c75
         | 
    
        data/MIT-LICENSE
    ADDED
    
    | @@ -0,0 +1,21 @@ | |
| 1 | 
            +
            The MIT License (MIT)
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            Copyright (c) 2013 Naga Vijayapuram
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            Permission is hereby granted, free of charge, to any person obtaining a copy
         | 
| 6 | 
            +
            of this software and associated documentation files (the "Software"), to deal
         | 
| 7 | 
            +
            in the Software without restriction, including without limitation the rights
         | 
| 8 | 
            +
            to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         | 
| 9 | 
            +
            copies of the Software, and to permit persons to whom the Software is
         | 
| 10 | 
            +
            furnished to do so, subject to the following conditions:
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            The above copyright notice and this permission notice shall be included in
         | 
| 13 | 
            +
            all copies or substantial portions of the Software.
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         | 
| 16 | 
            +
            IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         | 
| 17 | 
            +
            FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         | 
| 18 | 
            +
            AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         | 
| 19 | 
            +
            LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         | 
| 20 | 
            +
            OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
         | 
| 21 | 
            +
            THE SOFTWARE.
         | 
    
        data/README.md
    ADDED
    
    | @@ -0,0 +1,41 @@ | |
| 1 | 
            +
            pkp_physics
         | 
| 2 | 
            +
            ===========
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            IMPORTANT NOTE:
         | 
| 5 | 
            +
            --------------
         | 
| 6 | 
            +
            mathematics gem introduced/relied on "Prior Knowledge"
         | 
| 7 | 
            +
            (See https://github.com/nvijayap/mathematics)
         | 
| 8 | 
            +
            In continuation of that style/paradigm of programming,
         | 
| 9 | 
            +
            this program relies on elements of "Prior Knowledge"
         | 
| 10 | 
            +
            in the domain of Physics, and avoids
         | 
| 11 | 
            +
            computation where unnecessary.
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            About KBS:
         | 
| 14 | 
            +
            ---------
         | 
| 15 | 
            +
            KBS: Knowledge Base Space
         | 
| 16 | 
            +
            Some Examples for KBS:
         | 
| 17 | 
            +
            . Local Cache
         | 
| 18 | 
            +
            . Remote Cache
         | 
| 19 | 
            +
            . Use of Marshall/Unmarshall
         | 
| 20 | 
            +
            . Cache <=> DataStore (Activation/Passivation)
         | 
| 21 | 
            +
            . Web Service
         | 
| 22 | 
            +
            . Internet
         | 
| 23 | 
            +
            Prior Knowledge of the pattern/computation process/history
         | 
| 24 | 
            +
            shall lend to the path/approach to take.
         | 
| 25 | 
            +
             | 
| 26 | 
            +
            install
         | 
| 27 | 
            +
            =======
         | 
| 28 | 
            +
            gem install pkp_physics
         | 
| 29 | 
            +
             | 
| 30 | 
            +
            use
         | 
| 31 | 
            +
            ===
         | 
| 32 | 
            +
            require 'pkp_physics'<br/><br/>
         | 
| 33 | 
            +
            After installing, look into test/test_pkp_physics.rb<br/>
         | 
| 34 | 
            +
             | 
| 35 | 
            +
            comments
         | 
| 36 | 
            +
            ========
         | 
| 37 | 
            +
            Feel free to provide comments
         | 
| 38 | 
            +
             | 
| 39 | 
            +
            LICENSE
         | 
| 40 | 
            +
            =======
         | 
| 41 | 
            +
            MIT - http://opensource.org/licenses/MIT
         | 
    
        data/lib/pkp_physics.rb
    ADDED
    
    | @@ -0,0 +1,68 @@ | |
| 1 | 
            +
            #
         | 
| 2 | 
            +
            # pkp_physics.rb
         | 
| 3 | 
            +
            #
         | 
| 4 | 
            +
            # IMPORTANT NOTE:
         | 
| 5 | 
            +
            # --------------
         | 
| 6 | 
            +
            # mathematics gem introduced/relied on "Prior Knowledge"
         | 
| 7 | 
            +
            # (See https://github.com/nvijayap/mathematics)
         | 
| 8 | 
            +
            # In continuation of that style/paradigm of programming,
         | 
| 9 | 
            +
            # this program relies on elements of "Prior Knowledge"
         | 
| 10 | 
            +
            # in the domain of Physics, and avoids
         | 
| 11 | 
            +
            # computation where unnecessary.
         | 
| 12 | 
            +
            #
         | 
| 13 | 
            +
            # About KBS:
         | 
| 14 | 
            +
            # ---------
         | 
| 15 | 
            +
            # KBS: Knowledge Base Space
         | 
| 16 | 
            +
            # Some Examples for KBS:
         | 
| 17 | 
            +
            # . Local Cache
         | 
| 18 | 
            +
            # . Remote Cache
         | 
| 19 | 
            +
            # . Use of Marshall/Unmarshall
         | 
| 20 | 
            +
            # . Cache <=> DataStore (Activation/Passivation)
         | 
| 21 | 
            +
            # . Web Service
         | 
| 22 | 
            +
            # . Internet
         | 
| 23 | 
            +
            # Prior Knowledge of the pattern/computation process/history
         | 
| 24 | 
            +
            # shall lend to the path/approach to take.
         | 
| 25 | 
            +
            #
         | 
| 26 | 
            +
            module PKP # Stands for Prior_Knowledge_Programming
         | 
| 27 | 
            +
             | 
| 28 | 
            +
              module Physics
         | 
| 29 | 
            +
             | 
| 30 | 
            +
                # .. describe .......................
         | 
| 31 | 
            +
             | 
| 32 | 
            +
                def self.describe
         | 
| 33 | 
            +
                  "Physics module; Uses 'Prior Knowledge' as needed."
         | 
| 34 | 
            +
                end
         | 
| 35 | 
            +
             | 
| 36 | 
            +
                def self.desc # Just another desc method with a short name
         | 
| 37 | 
            +
                  describe
         | 
| 38 | 
            +
                end
         | 
| 39 | 
            +
             | 
| 40 | 
            +
                # .. celsius_to_fahrenheit .......................
         | 
| 41 | 
            +
             | 
| 42 | 
            +
                # This can be from KBS (Knowledge_Base_Space)
         | 
| 43 | 
            +
                @@c2f_hash = { 0 => 32, 100 => 212 } # Can be grown
         | 
| 44 | 
            +
             | 
| 45 | 
            +
                def self.celsius_to_fahrenheit celsius
         | 
| 46 | 
            +
                  if @@c2f_hash.has_key? celsius
         | 
| 47 | 
            +
            	@@c2f_hash[celsius]	# Use Prior Knowledge
         | 
| 48 | 
            +
                  else
         | 
| 49 | 
            +
            	1.8 * celsius + 32 	# Retrieve from KBS / Compute
         | 
| 50 | 
            +
                  end
         | 
| 51 | 
            +
                end
         | 
| 52 | 
            +
             | 
| 53 | 
            +
                # .. fahrenheit_to_celsius .......................
         | 
| 54 | 
            +
             | 
| 55 | 
            +
                # This can be from KBS (Knowledge_Base_Space)
         | 
| 56 | 
            +
                @@f2c_hash = { 32 => 0, 212 => 100 }
         | 
| 57 | 
            +
             | 
| 58 | 
            +
                def self.fahrenheit_to_celsius fahrenheit
         | 
| 59 | 
            +
                  if @@f2c_hash.has_key? fahrenheit
         | 
| 60 | 
            +
            	@@f2c_hash[fahrenheit]	# Use Prior Knowledge
         | 
| 61 | 
            +
                  else
         | 
| 62 | 
            +
            	(fahrenheit - 32)/1.8 	# Retrieve from KBS / Compute
         | 
| 63 | 
            +
                  end
         | 
| 64 | 
            +
                end
         | 
| 65 | 
            +
             | 
| 66 | 
            +
              end
         | 
| 67 | 
            +
             | 
| 68 | 
            +
            end
         | 
| @@ -0,0 +1,32 @@ | |
| 1 | 
            +
            require 'test/unit'
         | 
| 2 | 
            +
            require File.dirname(__FILE__) + '/../lib/pkp_physics'
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            class Test_PKP_Physics < Test::Unit::TestCase
         | 
| 5 | 
            +
             | 
| 6 | 
            +
              # .. test_describe and test_desc .......................
         | 
| 7 | 
            +
             | 
| 8 | 
            +
              def test_describe
         | 
| 9 | 
            +
                assert PKP::Physics.desc == "Physics module; Uses 'Prior Knowledge' as needed."
         | 
| 10 | 
            +
              end
         | 
| 11 | 
            +
             | 
| 12 | 
            +
              def test_desc
         | 
| 13 | 
            +
                assert PKP::Physics.desc == "Physics module; Uses 'Prior Knowledge' as needed."
         | 
| 14 | 
            +
              end
         | 
| 15 | 
            +
             | 
| 16 | 
            +
              # .. test_celsius_to_fahrenheit .......................
         | 
| 17 | 
            +
             | 
| 18 | 
            +
              def test_celsius_to_fahrenheit
         | 
| 19 | 
            +
                assert PKP::Physics.celsius_to_fahrenheit(0) == 32
         | 
| 20 | 
            +
                assert PKP::Physics.celsius_to_fahrenheit(100) == 212
         | 
| 21 | 
            +
                assert PKP::Physics.celsius_to_fahrenheit(50) == 122
         | 
| 22 | 
            +
              end
         | 
| 23 | 
            +
             | 
| 24 | 
            +
              # .. test_fahrenheit_to_celsius .......................
         | 
| 25 | 
            +
             | 
| 26 | 
            +
              def test_fahrenheit_to_celsius
         | 
| 27 | 
            +
                assert PKP::Physics.fahrenheit_to_celsius(32) == 0
         | 
| 28 | 
            +
                assert PKP::Physics.fahrenheit_to_celsius(212) == 100
         | 
| 29 | 
            +
                assert PKP::Physics.fahrenheit_to_celsius(122) == 50
         | 
| 30 | 
            +
              end
         | 
| 31 | 
            +
             | 
| 32 | 
            +
            end
         | 
    
        metadata
    ADDED
    
    | @@ -0,0 +1,47 @@ | |
| 1 | 
            +
            --- !ruby/object:Gem::Specification
         | 
| 2 | 
            +
            name: pkp_physics
         | 
| 3 | 
            +
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            +
              version: 0.0.0
         | 
| 5 | 
            +
            platform: ruby
         | 
| 6 | 
            +
            authors:
         | 
| 7 | 
            +
            - Naga Vijayapuram
         | 
| 8 | 
            +
            autorequire: 
         | 
| 9 | 
            +
            bindir: bin
         | 
| 10 | 
            +
            cert_chain: []
         | 
| 11 | 
            +
            date: 2013-10-04 00:00:00.000000000 Z
         | 
| 12 | 
            +
            dependencies: []
         | 
| 13 | 
            +
            description: PKP::Physics module; Uses 'Prior Knowledge' as needed.
         | 
| 14 | 
            +
            email: nice.ruby.gems@gmail.com
         | 
| 15 | 
            +
            executables: []
         | 
| 16 | 
            +
            extensions: []
         | 
| 17 | 
            +
            extra_rdoc_files: []
         | 
| 18 | 
            +
            files:
         | 
| 19 | 
            +
            - MIT-LICENSE
         | 
| 20 | 
            +
            - README.md
         | 
| 21 | 
            +
            - lib/pkp_physics.rb
         | 
| 22 | 
            +
            - test/test_pkp_physics.rb
         | 
| 23 | 
            +
            homepage: https://github.com/nvijayap/pkp_physics
         | 
| 24 | 
            +
            licenses:
         | 
| 25 | 
            +
            - MIT
         | 
| 26 | 
            +
            metadata: {}
         | 
| 27 | 
            +
            post_install_message: 
         | 
| 28 | 
            +
            rdoc_options: []
         | 
| 29 | 
            +
            require_paths:
         | 
| 30 | 
            +
            - lib
         | 
| 31 | 
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         | 
| 32 | 
            +
              requirements:
         | 
| 33 | 
            +
              - - '>='
         | 
| 34 | 
            +
                - !ruby/object:Gem::Version
         | 
| 35 | 
            +
                  version: '0'
         | 
| 36 | 
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 37 | 
            +
              requirements:
         | 
| 38 | 
            +
              - - '>='
         | 
| 39 | 
            +
                - !ruby/object:Gem::Version
         | 
| 40 | 
            +
                  version: '0'
         | 
| 41 | 
            +
            requirements: []
         | 
| 42 | 
            +
            rubyforge_project: 
         | 
| 43 | 
            +
            rubygems_version: 2.0.2
         | 
| 44 | 
            +
            signing_key: 
         | 
| 45 | 
            +
            specification_version: 4
         | 
| 46 | 
            +
            summary: Prior Knowledge Programming in the Realm of Physics
         | 
| 47 | 
            +
            test_files: []
         |