greater_less 0.1.0 → 0.1.1
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/.travis.yml +9 -1
- data/Gemfile +4 -5
- data/Gemfile.lock +1 -7
- data/README.md +142 -0
- data/Rakefile +13 -4
- data/VERSION +1 -1
- data/greater_less.gemspec +68 -0
- data/lib/greater_less.rb +18 -14
- data/spec/greater_less_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- metadata +112 -111
- data/README.rdoc +0 -103
    
        data/.travis.yml
    CHANGED
    
    
    
        data/Gemfile
    CHANGED
    
    | @@ -6,12 +6,11 @@ source "http://rubygems.org" | |
| 6 6 | 
             
            # Add dependencies to develop your gem here.
         | 
| 7 7 | 
             
            # Include everything needed to run rake, tests, features, etc.
         | 
| 8 8 | 
             
            group :development, :test do
         | 
| 9 | 
            -
              gem 'rspec'
         | 
| 10 | 
            -
              gem 'shoulda'
         | 
| 11 9 | 
             
              gem 'rdoc'
         | 
| 12 10 | 
             
              gem 'bundler'
         | 
| 13 11 | 
             
              gem 'jeweler'
         | 
| 14 | 
            -
              gem  | 
| 12 | 
            +
              gem 'rspec'
         | 
| 13 | 
            +
              gem 'shoulda-matchers'
         | 
| 14 | 
            +
              # gem "rcov", :platforms => :ruby_18
         | 
| 15 | 
            +
              gem 'simplecov', :require => false, :platforms => :ruby_19
         | 
| 15 16 | 
             
            end
         | 
| 16 | 
            -
             | 
| 17 | 
            -
            gem 'simplecov', :require => false, :group => :test
         | 
    
        data/Gemfile.lock
    CHANGED
    
    | @@ -21,16 +21,11 @@ GEM | |
| 21 21 | 
             
                rspec-expectations (2.8.0)
         | 
| 22 22 | 
             
                  diff-lcs (~> 1.1.2)
         | 
| 23 23 | 
             
                rspec-mocks (2.8.0)
         | 
| 24 | 
            -
                shoulda (3.0.1)
         | 
| 25 | 
            -
                  shoulda-context (~> 1.0.0)
         | 
| 26 | 
            -
                  shoulda-matchers (~> 1.0.0)
         | 
| 27 | 
            -
                shoulda-context (1.0.0)
         | 
| 28 24 | 
             
                shoulda-matchers (1.0.0)
         | 
| 29 25 | 
             
                simplecov (0.6.1)
         | 
| 30 26 | 
             
                  multi_json (~> 1.0)
         | 
| 31 27 | 
             
                  simplecov-html (~> 0.5.3)
         | 
| 32 28 | 
             
                simplecov-html (0.5.3)
         | 
| 33 | 
            -
                spork (0.8.5)
         | 
| 34 29 |  | 
| 35 30 | 
             
            PLATFORMS
         | 
| 36 31 | 
             
              ruby
         | 
| @@ -40,6 +35,5 @@ DEPENDENCIES | |
| 40 35 | 
             
              jeweler
         | 
| 41 36 | 
             
              rdoc
         | 
| 42 37 | 
             
              rspec
         | 
| 43 | 
            -
              shoulda
         | 
| 38 | 
            +
              shoulda-matchers
         | 
| 44 39 | 
             
              simplecov
         | 
| 45 | 
            -
              spork
         | 
    
        data/README.md
    ADDED
    
    | @@ -0,0 +1,142 @@ | |
| 1 | 
            +
            # GreaterLess
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            [](http://travis-ci.org/esposito/greater_less)
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            The GreaterLess gem can be used to generate objects that represent
         | 
| 6 | 
            +
            halfopen intervals, but transparently behave as Ruby Floats.
         | 
| 7 | 
            +
             | 
| 8 | 
            +
            ## Setup
         | 
| 9 | 
            +
             | 
| 10 | 
            +
            To install, type
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            ```bash
         | 
| 13 | 
            +
            sudo gem install greater_less
         | 
| 14 | 
            +
            ```
         | 
| 15 | 
            +
             | 
| 16 | 
            +
            If you are using bundler, add `greater_less` to your gemfile
         | 
| 17 | 
            +
             | 
| 18 | 
            +
            ```ruby
         | 
| 19 | 
            +
            gem 'greater_less'
         | 
| 20 | 
            +
            ```
         | 
| 21 | 
            +
             | 
| 22 | 
            +
            ## Getting Started
         | 
| 23 | 
            +
             | 
| 24 | 
            +
            One easy way to integrate this gem into your project is by requiring the GreaterLess
         | 
| 25 | 
            +
            string extension as follows:
         | 
| 26 | 
            +
             | 
| 27 | 
            +
            ```ruby
         | 
| 28 | 
            +
            require 'greater_less/string_extension'
         | 
| 29 | 
            +
            ```
         | 
| 30 | 
            +
             | 
| 31 | 
            +
            This extension redifines the `#to_f` method of the String class:
         | 
| 32 | 
            +
             | 
| 33 | 
            +
            ```ruby
         | 
| 34 | 
            +
            class String
         | 
| 35 | 
            +
              alias :to_f_without_greater_less :to_f
         | 
| 36 | 
            +
             | 
| 37 | 
            +
              def to_f
         | 
| 38 | 
            +
                if self =~ GreaterLess::GREATER_LESS
         | 
| 39 | 
            +
                  return GreaterLess.new(self)
         | 
| 40 | 
            +
                end
         | 
| 41 | 
            +
                self.to_f_without_greater_less
         | 
| 42 | 
            +
              end
         | 
| 43 | 
            +
            end
         | 
| 44 | 
            +
            ```
         | 
| 45 | 
            +
             | 
| 46 | 
            +
            Now when a string starts with a greater or less sign (like for instance
         | 
| 47 | 
            +
            `"> 3.45"`), the `#to_f` method converts it to a GreaterLess object
         | 
| 48 | 
            +
            instead of the value `0.0`.
         | 
| 49 | 
            +
             | 
| 50 | 
            +
            Of course you can opt to create GreaterLess objects using `initialize` directly, like so:
         | 
| 51 | 
            +
             | 
| 52 | 
            +
            ```ruby
         | 
| 53 | 
            +
            value = GreaterLess.new("> 3.45")
         | 
| 54 | 
            +
            ```
         | 
| 55 | 
            +
             | 
| 56 | 
            +
            ## Usage
         | 
| 57 | 
            +
             | 
| 58 | 
            +
            A GreaterLess object can be compared to a Float (or other numeric) as if it were a
         | 
| 59 | 
            +
            Float itself. For instance one can do the following:
         | 
| 60 | 
            +
             | 
| 61 | 
            +
            ```ruby
         | 
| 62 | 
            +
            >> value = ">3.45".to_f
         | 
| 63 | 
            +
            => > 3.45
         | 
| 64 | 
            +
            >> value > 2.45
         | 
| 65 | 
            +
            => true
         | 
| 66 | 
            +
            >> value >= 2.45
         | 
| 67 | 
            +
            => true
         | 
| 68 | 
            +
            >> 2.45 > value
         | 
| 69 | 
            +
            => false
         | 
| 70 | 
            +
            >> 2.45 >= value
         | 
| 71 | 
            +
            => false
         | 
| 72 | 
            +
            >> value == ">3.45".to_f
         | 
| 73 | 
            +
            => true
         | 
| 74 | 
            +
            >> value != 2.45
         | 
| 75 | 
            +
            => true
         | 
| 76 | 
            +
            ```
         | 
| 77 | 
            +
             | 
| 78 | 
            +
            It is also possible to compare GreaterLess objects with each other, so you
         | 
| 79 | 
            +
            do not have to worry about what kind of object you are dealing with in your
         | 
| 80 | 
            +
            code:
         | 
| 81 | 
            +
             | 
| 82 | 
            +
            ```ruby
         | 
| 83 | 
            +
            >> value1 = ">3.45".to_f
         | 
| 84 | 
            +
            => > 3.45
         | 
| 85 | 
            +
            >> value2 = "< 2.45".to_f
         | 
| 86 | 
            +
            => < 2.45
         | 
| 87 | 
            +
            >> value1 > value2
         | 
| 88 | 
            +
            => true
         | 
| 89 | 
            +
            >> value2 > value1
         | 
| 90 | 
            +
            => false
         | 
| 91 | 
            +
            ```
         | 
| 92 | 
            +
             | 
| 93 | 
            +
            Finally it is possible to apply simple arithmetics to GreaterLess objects
         | 
| 94 | 
            +
            like addition, subtraction, multiplication and division:
         | 
| 95 | 
            +
             | 
| 96 | 
            +
            ```ruby
         | 
| 97 | 
            +
            >> value = ">3.45".to_f
         | 
| 98 | 
            +
            => > 3.45
         | 
| 99 | 
            +
            >> value + 2
         | 
| 100 | 
            +
            => > 5.45
         | 
| 101 | 
            +
            >> value - 2
         | 
| 102 | 
            +
            => > 1.4500000000000002
         | 
| 103 | 
            +
            >> value * 2
         | 
| 104 | 
            +
            => > 1.725
         | 
| 105 | 
            +
            ```
         | 
| 106 | 
            +
             | 
| 107 | 
            +
            Inverting the object's sign when multiplying with a negative numerical
         | 
| 108 | 
            +
            or using a GreaterLess object in the denominator is nicely dealt with:
         | 
| 109 | 
            +
             | 
| 110 | 
            +
            ```ruby
         | 
| 111 | 
            +
            >> value = ">3.45".to_f
         | 
| 112 | 
            +
            => > 3.45
         | 
| 113 | 
            +
            >> -1 * value
         | 
| 114 | 
            +
            => < -3.45
         | 
| 115 | 
            +
            >> 1 / value
         | 
| 116 | 
            +
            => < 0.2898550724637681
         | 
| 117 | 
            +
            >> -1 / value
         | 
| 118 | 
            +
            => > -0.2898550724637681
         | 
| 119 | 
            +
            ```
         | 
| 120 | 
            +
             | 
| 121 | 
            +
            In many cases it makes no sense to apply the operators +, -, * or / on 
         | 
| 122 | 
            +
            a pair of GreaterLess objects, so when this happens an exception is 
         | 
| 123 | 
            +
            raised for now.
         | 
| 124 | 
            +
             | 
| 125 | 
            +
            All other methods are simply passed to the Float value the GreaterLess
         | 
| 126 | 
            +
            object contains, so that it transparently acts like a Float.
         | 
| 127 | 
            +
             | 
| 128 | 
            +
            ## Contributing to greater_less
         | 
| 129 | 
            +
             
         | 
| 130 | 
            +
            * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
         | 
| 131 | 
            +
            * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
         | 
| 132 | 
            +
            * Fork the project.
         | 
| 133 | 
            +
            * Start a feature/bugfix branch.
         | 
| 134 | 
            +
            * Commit and push until you are happy with your contribution.
         | 
| 135 | 
            +
            * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
         | 
| 136 | 
            +
            * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
         | 
| 137 | 
            +
             | 
| 138 | 
            +
            ## Copyright
         | 
| 139 | 
            +
             | 
| 140 | 
            +
            Copyright (c) 2012 Samuel Esposito. See LICENSE.txt for
         | 
| 141 | 
            +
            further details.
         | 
| 142 | 
            +
             | 
    
        data/Rakefile
    CHANGED
    
    | @@ -9,6 +9,7 @@ rescue Bundler::BundlerError => e | |
| 9 9 | 
             
              $stderr.puts "Run `bundle install` to install missing gems"
         | 
| 10 10 | 
             
              exit e.status_code
         | 
| 11 11 | 
             
            end
         | 
| 12 | 
            +
             | 
| 12 13 | 
             
            require 'rake'
         | 
| 13 14 |  | 
| 14 15 | 
             
            require 'jeweler'
         | 
| @@ -31,10 +32,18 @@ RSpec::Core::RakeTask.new(:spec) do |spec| | |
| 31 32 | 
             
              spec.pattern = FileList['spec/**/*_spec.rb']
         | 
| 32 33 | 
             
            end
         | 
| 33 34 |  | 
| 34 | 
            -
             | 
| 35 | 
            -
             | 
| 36 | 
            -
             | 
| 37 | 
            -
             | 
| 35 | 
            +
            if RUBY_VERSION =~ /^1\.9/
         | 
| 36 | 
            +
              desc "Code coverage detail"
         | 
| 37 | 
            +
              task :simplecov do
         | 
| 38 | 
            +
                ENV['COVERAGE'] = "true"
         | 
| 39 | 
            +
                Rake::Task['spec'].execute
         | 
| 40 | 
            +
              end
         | 
| 41 | 
            +
            # else
         | 
| 42 | 
            +
              # RSpec::Core::RakeTask.new(:rcov) do |spec|
         | 
| 43 | 
            +
              #   spec.pattern = 'spec/**/*_spec.rb'
         | 
| 44 | 
            +
              #   spec.rcov = true
         | 
| 45 | 
            +
              # end
         | 
| 46 | 
            +
            end
         | 
| 38 47 |  | 
| 39 48 | 
             
            task :default => :spec
         | 
| 40 49 |  | 
    
        data/VERSION
    CHANGED
    
    | @@ -1 +1 @@ | |
| 1 | 
            -
            0.1. | 
| 1 | 
            +
            0.1.1
         | 
| @@ -0,0 +1,68 @@ | |
| 1 | 
            +
            # Generated by jeweler
         | 
| 2 | 
            +
            # DO NOT EDIT THIS FILE DIRECTLY
         | 
| 3 | 
            +
            # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
         | 
| 4 | 
            +
            # -*- encoding: utf-8 -*-
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            Gem::Specification.new do |s|
         | 
| 7 | 
            +
              s.name = "greater_less"
         | 
| 8 | 
            +
              s.version = "0.1.1"
         | 
| 9 | 
            +
             | 
| 10 | 
            +
              s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
         | 
| 11 | 
            +
              s.authors = ["Samuel Esposito"]
         | 
| 12 | 
            +
              s.date = "2012-04-03"
         | 
| 13 | 
            +
              s.description = "The GreaterLess Gem allows for making comparisons between floats and half-open intervals and apply simple arithmetics to the intervals preserving their mathematical meaning."
         | 
| 14 | 
            +
              s.email = "s.esposito@roqua.nl"
         | 
| 15 | 
            +
              s.extra_rdoc_files = [
         | 
| 16 | 
            +
                "LICENSE.txt",
         | 
| 17 | 
            +
                "README.md"
         | 
| 18 | 
            +
              ]
         | 
| 19 | 
            +
              s.files = [
         | 
| 20 | 
            +
                ".document",
         | 
| 21 | 
            +
                ".rspec",
         | 
| 22 | 
            +
                ".travis.yml",
         | 
| 23 | 
            +
                "Gemfile",
         | 
| 24 | 
            +
                "Gemfile.lock",
         | 
| 25 | 
            +
                "LICENSE.txt",
         | 
| 26 | 
            +
                "README.md",
         | 
| 27 | 
            +
                "Rakefile",
         | 
| 28 | 
            +
                "VERSION",
         | 
| 29 | 
            +
                "greater_less.gemspec",
         | 
| 30 | 
            +
                "lib/greater_less.rb",
         | 
| 31 | 
            +
                "lib/greater_less/string_extension.rb",
         | 
| 32 | 
            +
                "spec/greater_less_spec.rb",
         | 
| 33 | 
            +
                "spec/spec_helper.rb"
         | 
| 34 | 
            +
              ]
         | 
| 35 | 
            +
              s.homepage = "http://github.com/esposito/greater_less"
         | 
| 36 | 
            +
              s.licenses = ["MIT"]
         | 
| 37 | 
            +
              s.require_paths = ["lib"]
         | 
| 38 | 
            +
              s.rubygems_version = "1.8.15"
         | 
| 39 | 
            +
              s.summary = "Gem for handling floating point half-open intervals"
         | 
| 40 | 
            +
             | 
| 41 | 
            +
              if s.respond_to? :specification_version then
         | 
| 42 | 
            +
                s.specification_version = 3
         | 
| 43 | 
            +
             | 
| 44 | 
            +
                if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
         | 
| 45 | 
            +
                  s.add_development_dependency(%q<rdoc>, [">= 0"])
         | 
| 46 | 
            +
                  s.add_development_dependency(%q<bundler>, [">= 0"])
         | 
| 47 | 
            +
                  s.add_development_dependency(%q<jeweler>, [">= 0"])
         | 
| 48 | 
            +
                  s.add_development_dependency(%q<rspec>, [">= 0"])
         | 
| 49 | 
            +
                  s.add_development_dependency(%q<shoulda-matchers>, [">= 0"])
         | 
| 50 | 
            +
                  s.add_development_dependency(%q<simplecov>, [">= 0"])
         | 
| 51 | 
            +
                else
         | 
| 52 | 
            +
                  s.add_dependency(%q<rdoc>, [">= 0"])
         | 
| 53 | 
            +
                  s.add_dependency(%q<bundler>, [">= 0"])
         | 
| 54 | 
            +
                  s.add_dependency(%q<jeweler>, [">= 0"])
         | 
| 55 | 
            +
                  s.add_dependency(%q<rspec>, [">= 0"])
         | 
| 56 | 
            +
                  s.add_dependency(%q<shoulda-matchers>, [">= 0"])
         | 
| 57 | 
            +
                  s.add_dependency(%q<simplecov>, [">= 0"])
         | 
| 58 | 
            +
                end
         | 
| 59 | 
            +
              else
         | 
| 60 | 
            +
                s.add_dependency(%q<rdoc>, [">= 0"])
         | 
| 61 | 
            +
                s.add_dependency(%q<bundler>, [">= 0"])
         | 
| 62 | 
            +
                s.add_dependency(%q<jeweler>, [">= 0"])
         | 
| 63 | 
            +
                s.add_dependency(%q<rspec>, [">= 0"])
         | 
| 64 | 
            +
                s.add_dependency(%q<shoulda-matchers>, [">= 0"])
         | 
| 65 | 
            +
                s.add_dependency(%q<simplecov>, [">= 0"])
         | 
| 66 | 
            +
              end
         | 
| 67 | 
            +
            end
         | 
| 68 | 
            +
             | 
    
        data/lib/greater_less.rb
    CHANGED
    
    | @@ -1,11 +1,11 @@ | |
| 1 1 | 
             
            # The GreaterLess class can be used to generate objects that represent
         | 
| 2 | 
            -
            # halfopen intervals, but transparently behave as Floats. One easy way to
         | 
| 3 | 
            -
            # integrate this class into your project is by requiring the  | 
| 2 | 
            +
            # halfopen intervals, but transparently behave as Ruby Floats. One easy way to
         | 
| 3 | 
            +
            # integrate this class into your project is by requiring the GreaterLess
         | 
| 4 4 | 
             
            # string extension as follows:
         | 
| 5 5 | 
             
            #
         | 
| 6 6 | 
             
            #  require 'greater_less/string_extension'
         | 
| 7 7 | 
             
            #
         | 
| 8 | 
            -
            # This extension redifines the +#to_f+ method of the String class | 
| 8 | 
            +
            # This extension redifines the +#to_f+ method of the String class:
         | 
| 9 9 | 
             
            #
         | 
| 10 10 | 
             
            #  class String
         | 
| 11 11 | 
             
            #    alias :to_f_without_greater_less :to_f
         | 
| @@ -21,10 +21,13 @@ | |
| 21 21 | 
             
            # Now when a string starts with a greater or less sign (like for instance
         | 
| 22 22 | 
             
            # <tt>"> 3.45"</tt>), the +#to_f+ method converts it to a GreaterLess object
         | 
| 23 23 | 
             
            # instead of the value +0.0+.
         | 
| 24 | 
            -
            #
         | 
| 25 | 
            -
            #  | 
| 26 | 
            -
            #  | 
| 27 | 
            -
            #  | 
| 24 | 
            +
            # 
         | 
| 25 | 
            +
            # Of course you can opt to create GreaterLess objects using +initialize+ directly, like so:
         | 
| 26 | 
            +
            # 
         | 
| 27 | 
            +
            #  value = GreaterLess.new("> 3.45")
         | 
| 28 | 
            +
            # 
         | 
| 29 | 
            +
            # A GreaterLess object can be compared to a Float (or other numeric) as if it were a
         | 
| 30 | 
            +
            # Float itself. For instance one can do the following:
         | 
| 28 31 | 
             
            #
         | 
| 29 32 | 
             
            #  >> value = ">3.45".to_f
         | 
| 30 33 | 
             
            #  => > 3.45
         | 
| @@ -41,7 +44,7 @@ | |
| 41 44 | 
             
            #  >> value != 2.45
         | 
| 42 45 | 
             
            #  => true
         | 
| 43 46 | 
             
            #
         | 
| 44 | 
            -
            # It is also possible to compare GreaterLess  | 
| 47 | 
            +
            # It is also possible to compare GreaterLess objects with each other, so you
         | 
| 45 48 | 
             
            # do not have to worry about what kind of object you are dealing with in your
         | 
| 46 49 | 
             
            # code:
         | 
| 47 50 | 
             
            #
         | 
| @@ -78,11 +81,12 @@ | |
| 78 81 | 
             
            #  >> -1 / value
         | 
| 79 82 | 
             
            #  => > -0.2898550724637681
         | 
| 80 83 | 
             
            #
         | 
| 81 | 
            -
            #  | 
| 82 | 
            -
            # objects, so an exception is  | 
| 84 | 
            +
            # In many cases it makes no sense to apply the operators +, -, * or / on 
         | 
| 85 | 
            +
            # a pair of GreaterLess objects, so when this happens an exception is 
         | 
| 86 | 
            +
            # raised for now.
         | 
| 83 87 | 
             
            #
         | 
| 84 | 
            -
            # All other methods are simply passed to the  | 
| 85 | 
            -
            # object contains, so that it transparently acts like a  | 
| 88 | 
            +
            # All other methods are simply passed to the Float value the GreaterLess
         | 
| 89 | 
            +
            # object contains, so that it transparently acts like a Float.
         | 
| 86 90 | 
             
            #
         | 
| 87 91 |  | 
| 88 92 | 
             
            class GreaterLess
         | 
| @@ -167,8 +171,8 @@ class GreaterLess | |
| 167 171 | 
             
                numerical > self
         | 
| 168 172 | 
             
              end
         | 
| 169 173 |  | 
| 170 | 
            -
               | 
| 171 | 
            -
                not self == numerical
         | 
| 174 | 
            +
              define_method("!=") do |numerical|
         | 
| 175 | 
            +
                not (self == numerical)
         | 
| 172 176 | 
             
              end
         | 
| 173 177 |  | 
| 174 178 | 
             
              def >=(numerical)
         | 
    
        data/spec/greater_less_spec.rb
    CHANGED
    
    | @@ -169,7 +169,7 @@ describe GreaterLess do | |
| 169 169 |  | 
| 170 170 | 
             
                  it "should carry out division on its float value" do
         | 
| 171 171 | 
             
                    (subject / 4).value.should == 4.5 / 4
         | 
| 172 | 
            -
                    (4 / subject).value.should == 4 / 4.5
         | 
| 172 | 
            +
                    (4 / subject).value.to_s.should == (4 / 4.5).to_s
         | 
| 173 173 | 
             
                  end
         | 
| 174 174 |  | 
| 175 175 | 
             
                  it "should retain the object's sign when the denominator is a positive numeric" do
         | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,161 +1,162 @@ | |
| 1 | 
            -
            --- !ruby/object:Gem::Specification
         | 
| 1 | 
            +
            --- !ruby/object:Gem::Specification 
         | 
| 2 2 | 
             
            name: greater_less
         | 
| 3 | 
            -
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
               | 
| 3 | 
            +
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            +
              hash: 25
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 | 
            +
              segments: 
         | 
| 7 | 
            +
              - 0
         | 
| 8 | 
            +
              - 1
         | 
| 9 | 
            +
              - 1
         | 
| 10 | 
            +
              version: 0.1.1
         | 
| 6 11 | 
             
            platform: ruby
         | 
| 7 | 
            -
            authors:
         | 
| 12 | 
            +
            authors: 
         | 
| 8 13 | 
             
            - Samuel Esposito
         | 
| 9 14 | 
             
            autorequire: 
         | 
| 10 15 | 
             
            bindir: bin
         | 
| 11 16 | 
             
            cert_chain: []
         | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 14 | 
            -
             | 
| 15 | 
            -
             | 
| 16 | 
            -
              requirement: !ruby/object:Gem::Requirement
         | 
| 17 | 
            -
                none: false
         | 
| 18 | 
            -
                requirements:
         | 
| 19 | 
            -
                - - ! '>='
         | 
| 20 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 21 | 
            -
                    version: '0'
         | 
| 22 | 
            -
              type: :development
         | 
| 23 | 
            -
              prerelease: false
         | 
| 24 | 
            -
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 17 | 
            +
             | 
| 18 | 
            +
            date: 2012-04-03 00:00:00 Z
         | 
| 19 | 
            +
            dependencies: 
         | 
| 20 | 
            +
            - !ruby/object:Gem::Dependency 
         | 
| 21 | 
            +
              requirement: &id001 !ruby/object:Gem::Requirement 
         | 
| 25 22 | 
             
                none: false
         | 
| 26 | 
            -
                requirements:
         | 
| 27 | 
            -
                - -  | 
| 28 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 29 | 
            -
                     | 
| 30 | 
            -
             | 
| 31 | 
            -
             | 
| 32 | 
            -
             | 
| 33 | 
            -
             | 
| 34 | 
            -
                requirements:
         | 
| 35 | 
            -
                - - ! '>='
         | 
| 36 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 37 | 
            -
                    version: '0'
         | 
| 38 | 
            -
              type: :development
         | 
| 39 | 
            -
              prerelease: false
         | 
| 40 | 
            -
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 41 | 
            -
                none: false
         | 
| 42 | 
            -
                requirements:
         | 
| 43 | 
            -
                - - ! '>='
         | 
| 44 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 45 | 
            -
                    version: '0'
         | 
| 46 | 
            -
            - !ruby/object:Gem::Dependency
         | 
| 23 | 
            +
                requirements: 
         | 
| 24 | 
            +
                - - ">="
         | 
| 25 | 
            +
                  - !ruby/object:Gem::Version 
         | 
| 26 | 
            +
                    hash: 3
         | 
| 27 | 
            +
                    segments: 
         | 
| 28 | 
            +
                    - 0
         | 
| 29 | 
            +
                    version: "0"
         | 
| 30 | 
            +
              version_requirements: *id001
         | 
| 47 31 | 
             
              name: rdoc
         | 
| 48 | 
            -
              requirement: !ruby/object:Gem::Requirement
         | 
| 49 | 
            -
                none: false
         | 
| 50 | 
            -
                requirements:
         | 
| 51 | 
            -
                - - ! '>='
         | 
| 52 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 53 | 
            -
                    version: '0'
         | 
| 54 | 
            -
              type: :development
         | 
| 55 32 | 
             
              prerelease: false
         | 
| 56 | 
            -
               | 
| 33 | 
            +
              type: :development
         | 
| 34 | 
            +
            - !ruby/object:Gem::Dependency 
         | 
| 35 | 
            +
              requirement: &id002 !ruby/object:Gem::Requirement 
         | 
| 57 36 | 
             
                none: false
         | 
| 58 | 
            -
                requirements:
         | 
| 59 | 
            -
                - -  | 
| 60 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 61 | 
            -
                     | 
| 62 | 
            -
             | 
| 37 | 
            +
                requirements: 
         | 
| 38 | 
            +
                - - ">="
         | 
| 39 | 
            +
                  - !ruby/object:Gem::Version 
         | 
| 40 | 
            +
                    hash: 3
         | 
| 41 | 
            +
                    segments: 
         | 
| 42 | 
            +
                    - 0
         | 
| 43 | 
            +
                    version: "0"
         | 
| 44 | 
            +
              version_requirements: *id002
         | 
| 63 45 | 
             
              name: bundler
         | 
| 64 | 
            -
              requirement: !ruby/object:Gem::Requirement
         | 
| 65 | 
            -
                none: false
         | 
| 66 | 
            -
                requirements:
         | 
| 67 | 
            -
                - - ! '>='
         | 
| 68 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 69 | 
            -
                    version: '0'
         | 
| 70 | 
            -
              type: :development
         | 
| 71 46 | 
             
              prerelease: false
         | 
| 72 | 
            -
               | 
| 47 | 
            +
              type: :development
         | 
| 48 | 
            +
            - !ruby/object:Gem::Dependency 
         | 
| 49 | 
            +
              requirement: &id003 !ruby/object:Gem::Requirement 
         | 
| 73 50 | 
             
                none: false
         | 
| 74 | 
            -
                requirements:
         | 
| 75 | 
            -
                - -  | 
| 76 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 77 | 
            -
                     | 
| 78 | 
            -
             | 
| 51 | 
            +
                requirements: 
         | 
| 52 | 
            +
                - - ">="
         | 
| 53 | 
            +
                  - !ruby/object:Gem::Version 
         | 
| 54 | 
            +
                    hash: 3
         | 
| 55 | 
            +
                    segments: 
         | 
| 56 | 
            +
                    - 0
         | 
| 57 | 
            +
                    version: "0"
         | 
| 58 | 
            +
              version_requirements: *id003
         | 
| 79 59 | 
             
              name: jeweler
         | 
| 80 | 
            -
              requirement: !ruby/object:Gem::Requirement
         | 
| 81 | 
            -
                none: false
         | 
| 82 | 
            -
                requirements:
         | 
| 83 | 
            -
                - - ! '>='
         | 
| 84 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 85 | 
            -
                    version: '0'
         | 
| 86 | 
            -
              type: :development
         | 
| 87 60 | 
             
              prerelease: false
         | 
| 88 | 
            -
               | 
| 89 | 
            -
             | 
| 90 | 
            -
             | 
| 91 | 
            -
                - - ! '>='
         | 
| 92 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 93 | 
            -
                    version: '0'
         | 
| 94 | 
            -
            - !ruby/object:Gem::Dependency
         | 
| 95 | 
            -
              name: spork
         | 
| 96 | 
            -
              requirement: !ruby/object:Gem::Requirement
         | 
| 61 | 
            +
              type: :development
         | 
| 62 | 
            +
            - !ruby/object:Gem::Dependency 
         | 
| 63 | 
            +
              requirement: &id004 !ruby/object:Gem::Requirement 
         | 
| 97 64 | 
             
                none: false
         | 
| 98 | 
            -
                requirements:
         | 
| 99 | 
            -
                - -  | 
| 100 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 101 | 
            -
                     | 
| 65 | 
            +
                requirements: 
         | 
| 66 | 
            +
                - - ">="
         | 
| 67 | 
            +
                  - !ruby/object:Gem::Version 
         | 
| 68 | 
            +
                    hash: 3
         | 
| 69 | 
            +
                    segments: 
         | 
| 70 | 
            +
                    - 0
         | 
| 71 | 
            +
                    version: "0"
         | 
| 72 | 
            +
              version_requirements: *id004
         | 
| 73 | 
            +
              name: rspec
         | 
| 74 | 
            +
              prerelease: false
         | 
| 102 75 | 
             
              type: :development
         | 
| 76 | 
            +
            - !ruby/object:Gem::Dependency 
         | 
| 77 | 
            +
              requirement: &id005 !ruby/object:Gem::Requirement 
         | 
| 78 | 
            +
                none: false
         | 
| 79 | 
            +
                requirements: 
         | 
| 80 | 
            +
                - - ">="
         | 
| 81 | 
            +
                  - !ruby/object:Gem::Version 
         | 
| 82 | 
            +
                    hash: 3
         | 
| 83 | 
            +
                    segments: 
         | 
| 84 | 
            +
                    - 0
         | 
| 85 | 
            +
                    version: "0"
         | 
| 86 | 
            +
              version_requirements: *id005
         | 
| 87 | 
            +
              name: shoulda-matchers
         | 
| 103 88 | 
             
              prerelease: false
         | 
| 104 | 
            -
               | 
| 89 | 
            +
              type: :development
         | 
| 90 | 
            +
            - !ruby/object:Gem::Dependency 
         | 
| 91 | 
            +
              requirement: &id006 !ruby/object:Gem::Requirement 
         | 
| 105 92 | 
             
                none: false
         | 
| 106 | 
            -
                requirements:
         | 
| 107 | 
            -
                - -  | 
| 108 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 109 | 
            -
                     | 
| 110 | 
            -
             | 
| 111 | 
            -
             | 
| 112 | 
            -
             | 
| 93 | 
            +
                requirements: 
         | 
| 94 | 
            +
                - - ">="
         | 
| 95 | 
            +
                  - !ruby/object:Gem::Version 
         | 
| 96 | 
            +
                    hash: 3
         | 
| 97 | 
            +
                    segments: 
         | 
| 98 | 
            +
                    - 0
         | 
| 99 | 
            +
                    version: "0"
         | 
| 100 | 
            +
              version_requirements: *id006
         | 
| 101 | 
            +
              name: simplecov
         | 
| 102 | 
            +
              prerelease: false
         | 
| 103 | 
            +
              type: :development
         | 
| 104 | 
            +
            description: The GreaterLess Gem allows for making comparisons between floats and half-open intervals and apply simple arithmetics to the intervals preserving their mathematical meaning.
         | 
| 113 105 | 
             
            email: s.esposito@roqua.nl
         | 
| 114 106 | 
             
            executables: []
         | 
| 107 | 
            +
             | 
| 115 108 | 
             
            extensions: []
         | 
| 116 | 
            -
             | 
| 109 | 
            +
             | 
| 110 | 
            +
            extra_rdoc_files: 
         | 
| 117 111 | 
             
            - LICENSE.txt
         | 
| 118 | 
            -
            - README. | 
| 119 | 
            -
            files:
         | 
| 112 | 
            +
            - README.md
         | 
| 113 | 
            +
            files: 
         | 
| 120 114 | 
             
            - .document
         | 
| 121 115 | 
             
            - .rspec
         | 
| 122 116 | 
             
            - .travis.yml
         | 
| 123 117 | 
             
            - Gemfile
         | 
| 124 118 | 
             
            - Gemfile.lock
         | 
| 125 119 | 
             
            - LICENSE.txt
         | 
| 126 | 
            -
            - README. | 
| 120 | 
            +
            - README.md
         | 
| 127 121 | 
             
            - Rakefile
         | 
| 128 122 | 
             
            - VERSION
         | 
| 123 | 
            +
            - greater_less.gemspec
         | 
| 129 124 | 
             
            - lib/greater_less.rb
         | 
| 130 125 | 
             
            - lib/greater_less/string_extension.rb
         | 
| 131 126 | 
             
            - spec/greater_less_spec.rb
         | 
| 132 127 | 
             
            - spec/spec_helper.rb
         | 
| 133 128 | 
             
            homepage: http://github.com/esposito/greater_less
         | 
| 134 | 
            -
            licenses:
         | 
| 129 | 
            +
            licenses: 
         | 
| 135 130 | 
             
            - MIT
         | 
| 136 131 | 
             
            post_install_message: 
         | 
| 137 132 | 
             
            rdoc_options: []
         | 
| 138 | 
            -
             | 
| 133 | 
            +
             | 
| 134 | 
            +
            require_paths: 
         | 
| 139 135 | 
             
            - lib
         | 
| 140 | 
            -
            required_ruby_version: !ruby/object:Gem::Requirement
         | 
| 136 | 
            +
            required_ruby_version: !ruby/object:Gem::Requirement 
         | 
| 141 137 | 
             
              none: false
         | 
| 142 | 
            -
              requirements:
         | 
| 143 | 
            -
              - -  | 
| 144 | 
            -
                - !ruby/object:Gem::Version
         | 
| 145 | 
            -
                   | 
| 146 | 
            -
                  segments:
         | 
| 138 | 
            +
              requirements: 
         | 
| 139 | 
            +
              - - ">="
         | 
| 140 | 
            +
                - !ruby/object:Gem::Version 
         | 
| 141 | 
            +
                  hash: 3
         | 
| 142 | 
            +
                  segments: 
         | 
| 147 143 | 
             
                  - 0
         | 
| 148 | 
            -
                   | 
| 149 | 
            -
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 144 | 
            +
                  version: "0"
         | 
| 145 | 
            +
            required_rubygems_version: !ruby/object:Gem::Requirement 
         | 
| 150 146 | 
             
              none: false
         | 
| 151 | 
            -
              requirements:
         | 
| 152 | 
            -
              - -  | 
| 153 | 
            -
                - !ruby/object:Gem::Version
         | 
| 154 | 
            -
                   | 
| 147 | 
            +
              requirements: 
         | 
| 148 | 
            +
              - - ">="
         | 
| 149 | 
            +
                - !ruby/object:Gem::Version 
         | 
| 150 | 
            +
                  hash: 3
         | 
| 151 | 
            +
                  segments: 
         | 
| 152 | 
            +
                  - 0
         | 
| 153 | 
            +
                  version: "0"
         | 
| 155 154 | 
             
            requirements: []
         | 
| 155 | 
            +
             | 
| 156 156 | 
             
            rubyforge_project: 
         | 
| 157 | 
            -
            rubygems_version: 1.8. | 
| 157 | 
            +
            rubygems_version: 1.8.15
         | 
| 158 158 | 
             
            signing_key: 
         | 
| 159 159 | 
             
            specification_version: 3
         | 
| 160 160 | 
             
            summary: Gem for handling floating point half-open intervals
         | 
| 161 161 | 
             
            test_files: []
         | 
| 162 | 
            +
             | 
    
        data/README.rdoc
    DELETED
    
    | @@ -1,103 +0,0 @@ | |
| 1 | 
            -
            = greater_less
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            The GreaterLess class can be used to generate objects that represent
         | 
| 4 | 
            -
            halfopen intervals, but transparently behave as Floats. One easy way to
         | 
| 5 | 
            -
            integrate this class into your project is by requiring the greater_less
         | 
| 6 | 
            -
            string extension as follows:
         | 
| 7 | 
            -
             | 
| 8 | 
            -
             require 'greater_less/string_extension'
         | 
| 9 | 
            -
             | 
| 10 | 
            -
            This extension redifines the +#to_f+ method of the String class as follows:
         | 
| 11 | 
            -
             | 
| 12 | 
            -
             class String
         | 
| 13 | 
            -
               alias :to_f_without_greater_less :to_f
         | 
| 14 | 
            -
             | 
| 15 | 
            -
               def to_f
         | 
| 16 | 
            -
                 if self =~ GreaterLess::GREATER_LESS
         | 
| 17 | 
            -
                   return GreaterLess.new(self)
         | 
| 18 | 
            -
                 end
         | 
| 19 | 
            -
                 self.to_f_without_greater_less
         | 
| 20 | 
            -
               end
         | 
| 21 | 
            -
             end
         | 
| 22 | 
            -
             | 
| 23 | 
            -
            Now when a string starts with a greater or less sign (like for instance
         | 
| 24 | 
            -
            <tt>"> 3.45"</tt>), the +#to_f+ method converts it to a GreaterLess object
         | 
| 25 | 
            -
            instead of the value +0.0+.
         | 
| 26 | 
            -
             | 
| 27 | 
            -
            With this extension in place one can simply convert strings like the one
         | 
| 28 | 
            -
            above to a float like object and compare it to floats as if it were a
         | 
| 29 | 
            -
            float itself. For instance one can do the following:
         | 
| 30 | 
            -
             | 
| 31 | 
            -
             >> value = ">3.45".to_f
         | 
| 32 | 
            -
             => > 3.45
         | 
| 33 | 
            -
             >> value > 2.45
         | 
| 34 | 
            -
             => true
         | 
| 35 | 
            -
             >> value >= 2.45
         | 
| 36 | 
            -
             => true
         | 
| 37 | 
            -
             >> 2.45 > value
         | 
| 38 | 
            -
             => false
         | 
| 39 | 
            -
             >> 2.45 >= value
         | 
| 40 | 
            -
             => false
         | 
| 41 | 
            -
             >> value == ">3.45".to_f
         | 
| 42 | 
            -
             => true
         | 
| 43 | 
            -
             >> value != 2.45
         | 
| 44 | 
            -
             => true
         | 
| 45 | 
            -
             | 
| 46 | 
            -
            It is also possible to compare GreaterLess values with each other, so you
         | 
| 47 | 
            -
            do not have to worry about what kind of object you are dealing with in your
         | 
| 48 | 
            -
            code:
         | 
| 49 | 
            -
             | 
| 50 | 
            -
             >> value1 = ">3.45".to_f
         | 
| 51 | 
            -
             => > 3.45
         | 
| 52 | 
            -
             >> value2 = "< 2.45".to_f
         | 
| 53 | 
            -
             => < 2.45
         | 
| 54 | 
            -
             >> value1 > value2
         | 
| 55 | 
            -
             => true
         | 
| 56 | 
            -
             >> value2 > value1
         | 
| 57 | 
            -
             => false
         | 
| 58 | 
            -
             | 
| 59 | 
            -
            Finally it is possible to apply simple arithmetics to GreaterLess objects
         | 
| 60 | 
            -
            like addition, subtraction, multiplication and division:
         | 
| 61 | 
            -
             | 
| 62 | 
            -
             >> value = ">3.45".to_f
         | 
| 63 | 
            -
             => > 3.45
         | 
| 64 | 
            -
             >> value + 2
         | 
| 65 | 
            -
             => > 5.45
         | 
| 66 | 
            -
             >> value - 2
         | 
| 67 | 
            -
             => > 1.4500000000000002
         | 
| 68 | 
            -
             >> value * 2
         | 
| 69 | 
            -
             => > 1.725
         | 
| 70 | 
            -
             | 
| 71 | 
            -
            Inverting the object's sign when multiplying with a negative numerical
         | 
| 72 | 
            -
            or using a GreaterLess object in the denominator is nicely dealt with:
         | 
| 73 | 
            -
             | 
| 74 | 
            -
             >> value = ">3.45".to_f
         | 
| 75 | 
            -
             => > 3.45
         | 
| 76 | 
            -
             >> -1 * value
         | 
| 77 | 
            -
             => < -3.45
         | 
| 78 | 
            -
             >> 1 / value
         | 
| 79 | 
            -
             => < 0.2898550724637681
         | 
| 80 | 
            -
             >> -1 / value
         | 
| 81 | 
            -
             => > -0.2898550724637681
         | 
| 82 | 
            -
             | 
| 83 | 
            -
            It makes no sense to apply the operators +, -, * or / on a pair of GreaterLess
         | 
| 84 | 
            -
            objects, so an exception is raised in these cases.
         | 
| 85 | 
            -
             | 
| 86 | 
            -
            All other methods are simply passed to the float value the GreaterLess
         | 
| 87 | 
            -
            object contains, so that it transparently acts like a float.
         | 
| 88 | 
            -
             | 
| 89 | 
            -
            == Contributing to greater_less
         | 
| 90 | 
            -
             
         | 
| 91 | 
            -
            * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
         | 
| 92 | 
            -
            * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
         | 
| 93 | 
            -
            * Fork the project.
         | 
| 94 | 
            -
            * Start a feature/bugfix branch.
         | 
| 95 | 
            -
            * Commit and push until you are happy with your contribution.
         | 
| 96 | 
            -
            * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
         | 
| 97 | 
            -
            * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
         | 
| 98 | 
            -
             | 
| 99 | 
            -
            == Copyright
         | 
| 100 | 
            -
             | 
| 101 | 
            -
            Copyright (c) 2012 Samuel Esposito. See LICENSE.txt for
         | 
| 102 | 
            -
            further details.
         | 
| 103 | 
            -
             |