enumerabull 0.0.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/Gemfile +4 -0
 - data/LICENSE +13 -0
 - data/README.md +12 -0
 - data/Rakefile +8 -0
 - data/enumerabull.gemspec +19 -0
 - data/lib/enumerabull.rb +17 -0
 - data/spec/enumerabull_spec.rb +291 -0
 - data/spec/spec_helper.rb +1 -0
 - metadata +90 -0
 
    
        data/Gemfile
    ADDED
    
    
    
        data/LICENSE
    ADDED
    
    | 
         @@ -0,0 +1,13 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
                        DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
         
     | 
| 
      
 2 
     | 
    
         
            +
                                Version 2, December 2004
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
             Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
             Everyone is permitted to copy and distribute verbatim or modified
         
     | 
| 
      
 7 
     | 
    
         
            +
             copies of this license document, and changing it is allowed as long
         
     | 
| 
      
 8 
     | 
    
         
            +
             as the name is changed.
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                        DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
         
     | 
| 
      
 11 
     | 
    
         
            +
               TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
              0. You just DO WHAT THE FUCK YOU WANT TO.
         
     | 
    
        data/README.md
    ADDED
    
    | 
         @@ -0,0 +1,12 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # Enumerabull
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            Enumerabull pollutes Kernelspace with inverted versions of Enumerable's instance methods.
         
     | 
| 
      
 4 
     | 
    
         
            +
            It's like unleashing a bull in your Ruby shop to get "functional programming".
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            ## Usage
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            ``` ruby
         
     | 
| 
      
 9 
     | 
    
         
            +
            p reduce :+, 10, 1..10
         
     | 
| 
      
 10 
     | 
    
         
            +
            p select :even?, 1..10
         
     | 
| 
      
 11 
     | 
    
         
            +
            each->n { p n }, 1..10
         
     | 
| 
      
 12 
     | 
    
         
            +
            ```
         
     | 
    
        data/Rakefile
    ADDED
    
    
    
        data/enumerabull.gemspec
    ADDED
    
    | 
         @@ -0,0 +1,19 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # coding: utf-8
         
     | 
| 
      
 2 
     | 
    
         
            +
            lib = File.expand_path('../lib', __FILE__)
         
     | 
| 
      
 3 
     | 
    
         
            +
            $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            Gem::Specification.new do |spec|
         
     | 
| 
      
 6 
     | 
    
         
            +
              spec.name          = "enumerabull"
         
     | 
| 
      
 7 
     | 
    
         
            +
              spec.version       = "0.0.1"
         
     | 
| 
      
 8 
     | 
    
         
            +
              spec.authors       = ["Three If By Whiskey"]
         
     | 
| 
      
 9 
     | 
    
         
            +
              spec.email         = ["3ifbyw@gmail.com"]
         
     | 
| 
      
 10 
     | 
    
         
            +
              spec.summary       = %[Enumerabull pollutes Kernelspace with inverted versions of Enumerable's instance methods. It's like unleashing a bull in your Ruby shop to get "functional programming".]
         
     | 
| 
      
 11 
     | 
    
         
            +
              spec.license       = "WTFPL"
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
              spec.files         = `git ls-files -z`.split("\x0")
         
     | 
| 
      
 14 
     | 
    
         
            +
              spec.test_files    = spec.files.grep(/spec/)
         
     | 
| 
      
 15 
     | 
    
         
            +
              spec.require_paths = ["lib"]
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
              spec.add_development_dependency "bundler", "~> 1.5"
         
     | 
| 
      
 18 
     | 
    
         
            +
              spec.add_development_dependency "rake"
         
     | 
| 
      
 19 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/enumerabull.rb
    ADDED
    
    | 
         @@ -0,0 +1,17 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Kernel
         
     | 
| 
      
 2 
     | 
    
         
            +
              Enumerable.instance_methods.each do |meth|
         
     | 
| 
      
 3 
     | 
    
         
            +
                define_method(meth) do |*args|
         
     | 
| 
      
 4 
     | 
    
         
            +
                  obj = args.pop
         
     | 
| 
      
 5 
     | 
    
         
            +
                  case pred = args.first
         
     | 
| 
      
 6 
     | 
    
         
            +
                  when Proc, Symbol
         
     | 
| 
      
 7 
     | 
    
         
            +
                    obj.send meth, *args.drop(1), &pred
         
     | 
| 
      
 8 
     | 
    
         
            +
                  else
         
     | 
| 
      
 9 
     | 
    
         
            +
                    obj.send meth, *args
         
     | 
| 
      
 10 
     | 
    
         
            +
                  end
         
     | 
| 
      
 11 
     | 
    
         
            +
                end
         
     | 
| 
      
 12 
     | 
    
         
            +
              end
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
              alias each   each_entry
         
     | 
| 
      
 15 
     | 
    
         
            +
              alias filter select
         
     | 
| 
      
 16 
     | 
    
         
            +
              alias remove reject
         
     | 
| 
      
 17 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,291 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'spec_helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            describe 'Enumerabull' do
         
     | 
| 
      
 4 
     | 
    
         
            +
              Enumerable.instance_methods.each do |meth|
         
     | 
| 
      
 5 
     | 
    
         
            +
                it "should add Enumerable#{meth} to Kernel" do
         
     | 
| 
      
 6 
     | 
    
         
            +
                  Kernel.should respond_to meth
         
     | 
| 
      
 7 
     | 
    
         
            +
                end
         
     | 
| 
      
 8 
     | 
    
         
            +
              end
         
     | 
| 
      
 9 
     | 
    
         
            +
            end
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            describe 'Kernel.all?' do
         
     | 
| 
      
 12 
     | 
    
         
            +
              it 'should behave like Enumerable#all?' do
         
     | 
| 
      
 13 
     | 
    
         
            +
                all?(:even?, [2, 4, 6]).should be_true
         
     | 
| 
      
 14 
     | 
    
         
            +
              end
         
     | 
| 
      
 15 
     | 
    
         
            +
            end
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            describe 'Kernel.any?' do
         
     | 
| 
      
 18 
     | 
    
         
            +
              it 'should behave like Enumerable#any?' do
         
     | 
| 
      
 19 
     | 
    
         
            +
                any?(:odd?, [2, 4, 6]).should be_false
         
     | 
| 
      
 20 
     | 
    
         
            +
              end
         
     | 
| 
      
 21 
     | 
    
         
            +
            end
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
            describe 'Kernel.chunk' do
         
     | 
| 
      
 24 
     | 
    
         
            +
              it 'should behave like Enumerable#chunk' do
         
     | 
| 
      
 25 
     | 
    
         
            +
                chunk(:even?, 1..10).to_a.should == (1..10).chunk(&:even?).to_a
         
     | 
| 
      
 26 
     | 
    
         
            +
              end
         
     | 
| 
      
 27 
     | 
    
         
            +
            end
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
            describe 'Kernel.collect' do
         
     | 
| 
      
 30 
     | 
    
         
            +
              it 'should behave like Enumerable#collect' do
         
     | 
| 
      
 31 
     | 
    
         
            +
                collect(-> x { x + 1 }, 1..3).should == [2, 3, 4]
         
     | 
| 
      
 32 
     | 
    
         
            +
              end
         
     | 
| 
      
 33 
     | 
    
         
            +
            end
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
            describe 'Kernel.collect_concat' do
         
     | 
| 
      
 36 
     | 
    
         
            +
              it 'should behave like Enumerable#collect_concat' do
         
     | 
| 
      
 37 
     | 
    
         
            +
                collect_concat(-> x { [x - 1, x + 1] }, 1..2).should == [0, 2, 1, 3]
         
     | 
| 
      
 38 
     | 
    
         
            +
              end
         
     | 
| 
      
 39 
     | 
    
         
            +
            end
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
            describe 'Kernel.count' do
         
     | 
| 
      
 42 
     | 
    
         
            +
              it 'should behave like Enumerable#count' do
         
     | 
| 
      
 43 
     | 
    
         
            +
                count(:even?, 1..10).should == 5
         
     | 
| 
      
 44 
     | 
    
         
            +
              end
         
     | 
| 
      
 45 
     | 
    
         
            +
            end
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
            describe 'Kernel.cycle' do
         
     | 
| 
      
 48 
     | 
    
         
            +
              it 'should behave like Enumerable#cycle' do
         
     | 
| 
      
 49 
     | 
    
         
            +
                cycle(2, [1, 2]).to_a.should == [1, 2, 1, 2]
         
     | 
| 
      
 50 
     | 
    
         
            +
              end
         
     | 
| 
      
 51 
     | 
    
         
            +
            end
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
            describe 'Kernel.detect' do
         
     | 
| 
      
 54 
     | 
    
         
            +
              it 'should behave like Enumerable#detect' do
         
     | 
| 
      
 55 
     | 
    
         
            +
                detect(:even?, [1, 3, 4]).should == 4
         
     | 
| 
      
 56 
     | 
    
         
            +
              end
         
     | 
| 
      
 57 
     | 
    
         
            +
            end
         
     | 
| 
      
 58 
     | 
    
         
            +
             
     | 
| 
      
 59 
     | 
    
         
            +
            describe 'Kernel.drop' do
         
     | 
| 
      
 60 
     | 
    
         
            +
              it 'should behave like Enumerable#drop' do
         
     | 
| 
      
 61 
     | 
    
         
            +
                drop(2, 1..4).should == [3, 4]
         
     | 
| 
      
 62 
     | 
    
         
            +
              end
         
     | 
| 
      
 63 
     | 
    
         
            +
            end
         
     | 
| 
      
 64 
     | 
    
         
            +
             
     | 
| 
      
 65 
     | 
    
         
            +
            describe 'Kernel.drop_while' do
         
     | 
| 
      
 66 
     | 
    
         
            +
              it 'should behave like Enumerable#drop_while' do
         
     | 
| 
      
 67 
     | 
    
         
            +
                drop_while(-> x { x < 5 }, 1..5).should == [5]
         
     | 
| 
      
 68 
     | 
    
         
            +
              end
         
     | 
| 
      
 69 
     | 
    
         
            +
            end
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
      
 71 
     | 
    
         
            +
            describe 'Kernel.each_cons' do
         
     | 
| 
      
 72 
     | 
    
         
            +
              it 'should behave like Enumerable#each_cons' do
         
     | 
| 
      
 73 
     | 
    
         
            +
                each_cons(2, 1..10).to_a.should == (1..10).each_cons(2).to_a
         
     | 
| 
      
 74 
     | 
    
         
            +
              end
         
     | 
| 
      
 75 
     | 
    
         
            +
            end
         
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
      
 77 
     | 
    
         
            +
            describe 'Kernel.each_entry' do
         
     | 
| 
      
 78 
     | 
    
         
            +
              it 'should behave like Enumerable#each_entry' do
         
     | 
| 
      
 79 
     | 
    
         
            +
                each_entry(1..3).to_a.should == (1..3).each_entry.to_a
         
     | 
| 
      
 80 
     | 
    
         
            +
              end
         
     | 
| 
      
 81 
     | 
    
         
            +
            end
         
     | 
| 
      
 82 
     | 
    
         
            +
             
     | 
| 
      
 83 
     | 
    
         
            +
            describe 'Kernel.each_slice' do
         
     | 
| 
      
 84 
     | 
    
         
            +
              it 'should behave like Enumerable#each_slice' do
         
     | 
| 
      
 85 
     | 
    
         
            +
                each_slice(2, 1..6).to_a.should == (1..6).each_slice(2).to_a
         
     | 
| 
      
 86 
     | 
    
         
            +
              end
         
     | 
| 
      
 87 
     | 
    
         
            +
            end
         
     | 
| 
      
 88 
     | 
    
         
            +
             
     | 
| 
      
 89 
     | 
    
         
            +
            describe 'Kernel.each_with_index' do
         
     | 
| 
      
 90 
     | 
    
         
            +
              it 'should behave like Enumerable#each_with_index' do
         
     | 
| 
      
 91 
     | 
    
         
            +
                each_with_index(1..3).to_a.should == (1..3).each_with_index.to_a
         
     | 
| 
      
 92 
     | 
    
         
            +
              end
         
     | 
| 
      
 93 
     | 
    
         
            +
            end
         
     | 
| 
      
 94 
     | 
    
         
            +
             
     | 
| 
      
 95 
     | 
    
         
            +
            describe 'Kernel.each_with_object' do
         
     | 
| 
      
 96 
     | 
    
         
            +
              it 'should behave like Enumerable#each_with_object' do
         
     | 
| 
      
 97 
     | 
    
         
            +
                each_with_object({}, 1..3).to_a.should == (1..3).each_with_object({}).to_a
         
     | 
| 
      
 98 
     | 
    
         
            +
              end
         
     | 
| 
      
 99 
     | 
    
         
            +
            end
         
     | 
| 
      
 100 
     | 
    
         
            +
             
     | 
| 
      
 101 
     | 
    
         
            +
            describe 'Kernel.entries' do
         
     | 
| 
      
 102 
     | 
    
         
            +
              it 'should behave like Enumerable#entries' do
         
     | 
| 
      
 103 
     | 
    
         
            +
                entries(1..3).should == (1..3).entries
         
     | 
| 
      
 104 
     | 
    
         
            +
              end
         
     | 
| 
      
 105 
     | 
    
         
            +
            end
         
     | 
| 
      
 106 
     | 
    
         
            +
             
     | 
| 
      
 107 
     | 
    
         
            +
            describe 'Kernel.find' do
         
     | 
| 
      
 108 
     | 
    
         
            +
              it 'should behave like Enumerable#find' do
         
     | 
| 
      
 109 
     | 
    
         
            +
                find(:even?, [1, 3, 4]).should == 4
         
     | 
| 
      
 110 
     | 
    
         
            +
              end
         
     | 
| 
      
 111 
     | 
    
         
            +
            end
         
     | 
| 
      
 112 
     | 
    
         
            +
             
     | 
| 
      
 113 
     | 
    
         
            +
            describe 'Kernel.find_all' do
         
     | 
| 
      
 114 
     | 
    
         
            +
              it 'should behave like Enumerable#find_all' do
         
     | 
| 
      
 115 
     | 
    
         
            +
                find_all(:even?, 1..6).should == [2, 4, 6]
         
     | 
| 
      
 116 
     | 
    
         
            +
              end
         
     | 
| 
      
 117 
     | 
    
         
            +
            end
         
     | 
| 
      
 118 
     | 
    
         
            +
             
     | 
| 
      
 119 
     | 
    
         
            +
            describe 'Kernel.find_index' do
         
     | 
| 
      
 120 
     | 
    
         
            +
              it 'should behave like Enumerable#find_index' do
         
     | 
| 
      
 121 
     | 
    
         
            +
                find_index(:even?, [1, 3, 4]).should == 2
         
     | 
| 
      
 122 
     | 
    
         
            +
              end
         
     | 
| 
      
 123 
     | 
    
         
            +
            end
         
     | 
| 
      
 124 
     | 
    
         
            +
             
     | 
| 
      
 125 
     | 
    
         
            +
            describe 'Kernel.first' do
         
     | 
| 
      
 126 
     | 
    
         
            +
              it 'should behave like Enumerable#first' do
         
     | 
| 
      
 127 
     | 
    
         
            +
                first([1, 2, 3]).should == 1
         
     | 
| 
      
 128 
     | 
    
         
            +
              end
         
     | 
| 
      
 129 
     | 
    
         
            +
            end
         
     | 
| 
      
 130 
     | 
    
         
            +
             
     | 
| 
      
 131 
     | 
    
         
            +
            describe 'Kernel.flat_map' do
         
     | 
| 
      
 132 
     | 
    
         
            +
              it 'should behave like Enumerable#flat_map' do
         
     | 
| 
      
 133 
     | 
    
         
            +
                flat_map(-> x { [x - 1, x + 1] }, 1..2).should == [0, 2, 1, 3]
         
     | 
| 
      
 134 
     | 
    
         
            +
              end
         
     | 
| 
      
 135 
     | 
    
         
            +
            end
         
     | 
| 
      
 136 
     | 
    
         
            +
             
     | 
| 
      
 137 
     | 
    
         
            +
            describe 'Kernel.grep' do
         
     | 
| 
      
 138 
     | 
    
         
            +
              it 'should behave like Enumerable#grep' do
         
     | 
| 
      
 139 
     | 
    
         
            +
                grep(Symbol, [1, :a, 2, :b]).should == [:a, :b]
         
     | 
| 
      
 140 
     | 
    
         
            +
              end
         
     | 
| 
      
 141 
     | 
    
         
            +
            end
         
     | 
| 
      
 142 
     | 
    
         
            +
             
     | 
| 
      
 143 
     | 
    
         
            +
            describe 'Kernel.group_by' do
         
     | 
| 
      
 144 
     | 
    
         
            +
              it 'should behave like Enumerable#group_by' do
         
     | 
| 
      
 145 
     | 
    
         
            +
                group_by(:even?, 1..4).values.should == [[1, 3], [2, 4]]
         
     | 
| 
      
 146 
     | 
    
         
            +
              end
         
     | 
| 
      
 147 
     | 
    
         
            +
            end
         
     | 
| 
      
 148 
     | 
    
         
            +
             
     | 
| 
      
 149 
     | 
    
         
            +
            describe 'Kernel.include?' do
         
     | 
| 
      
 150 
     | 
    
         
            +
              it 'should behave like Enumerable#include?' do
         
     | 
| 
      
 151 
     | 
    
         
            +
                include?(2, 1..3).should be_true
         
     | 
| 
      
 152 
     | 
    
         
            +
              end
         
     | 
| 
      
 153 
     | 
    
         
            +
            end
         
     | 
| 
      
 154 
     | 
    
         
            +
             
     | 
| 
      
 155 
     | 
    
         
            +
            describe 'Kernel.inject' do
         
     | 
| 
      
 156 
     | 
    
         
            +
              it 'should behave like Enumerable#inject' do
         
     | 
| 
      
 157 
     | 
    
         
            +
                inject(:+, 1..3).should == 6
         
     | 
| 
      
 158 
     | 
    
         
            +
              end
         
     | 
| 
      
 159 
     | 
    
         
            +
            end
         
     | 
| 
      
 160 
     | 
    
         
            +
             
     | 
| 
      
 161 
     | 
    
         
            +
            describe 'Kernel.map' do
         
     | 
| 
      
 162 
     | 
    
         
            +
              it 'should behave like Enumerable#map' do
         
     | 
| 
      
 163 
     | 
    
         
            +
                map(:to_s, 1..3).should == %w[1 2 3]
         
     | 
| 
      
 164 
     | 
    
         
            +
              end
         
     | 
| 
      
 165 
     | 
    
         
            +
            end
         
     | 
| 
      
 166 
     | 
    
         
            +
             
     | 
| 
      
 167 
     | 
    
         
            +
            describe 'Kernel.max' do
         
     | 
| 
      
 168 
     | 
    
         
            +
              it 'should behave like Enumerable#max' do
         
     | 
| 
      
 169 
     | 
    
         
            +
                max(1..3).should == 3
         
     | 
| 
      
 170 
     | 
    
         
            +
              end
         
     | 
| 
      
 171 
     | 
    
         
            +
            end
         
     | 
| 
      
 172 
     | 
    
         
            +
             
     | 
| 
      
 173 
     | 
    
         
            +
            describe 'Kernel.max_by' do
         
     | 
| 
      
 174 
     | 
    
         
            +
              it 'should behave like Enumerable#max_by' do
         
     | 
| 
      
 175 
     | 
    
         
            +
                max_by(:size, %w[a bb ccc]).should == 'ccc'
         
     | 
| 
      
 176 
     | 
    
         
            +
              end
         
     | 
| 
      
 177 
     | 
    
         
            +
            end
         
     | 
| 
      
 178 
     | 
    
         
            +
             
     | 
| 
      
 179 
     | 
    
         
            +
            describe 'Kernel.member?' do
         
     | 
| 
      
 180 
     | 
    
         
            +
              it 'should behave like Enumerable#member?' do
         
     | 
| 
      
 181 
     | 
    
         
            +
                member?(2, 1..3).should be_true
         
     | 
| 
      
 182 
     | 
    
         
            +
              end
         
     | 
| 
      
 183 
     | 
    
         
            +
            end
         
     | 
| 
      
 184 
     | 
    
         
            +
             
     | 
| 
      
 185 
     | 
    
         
            +
            describe 'Kernel.min' do
         
     | 
| 
      
 186 
     | 
    
         
            +
              it 'should behave like Enumerable#min' do
         
     | 
| 
      
 187 
     | 
    
         
            +
                min(1..3).should == 1
         
     | 
| 
      
 188 
     | 
    
         
            +
              end
         
     | 
| 
      
 189 
     | 
    
         
            +
            end
         
     | 
| 
      
 190 
     | 
    
         
            +
             
     | 
| 
      
 191 
     | 
    
         
            +
            describe 'Kernel.min_by' do
         
     | 
| 
      
 192 
     | 
    
         
            +
              it 'should behave like Enumerable#min_by' do
         
     | 
| 
      
 193 
     | 
    
         
            +
                min_by(:size, %w[a bb ccc]).should == 'a'
         
     | 
| 
      
 194 
     | 
    
         
            +
              end
         
     | 
| 
      
 195 
     | 
    
         
            +
            end
         
     | 
| 
      
 196 
     | 
    
         
            +
             
     | 
| 
      
 197 
     | 
    
         
            +
            describe 'Kernel.minmax' do
         
     | 
| 
      
 198 
     | 
    
         
            +
              it 'should behave like Enumerable#minmax' do
         
     | 
| 
      
 199 
     | 
    
         
            +
                minmax(1..5).should == [1, 5]
         
     | 
| 
      
 200 
     | 
    
         
            +
              end
         
     | 
| 
      
 201 
     | 
    
         
            +
            end
         
     | 
| 
      
 202 
     | 
    
         
            +
             
     | 
| 
      
 203 
     | 
    
         
            +
            describe 'Kernel.minmax_by' do
         
     | 
| 
      
 204 
     | 
    
         
            +
              it 'should behave like Enumerable#minmax_by' do
         
     | 
| 
      
 205 
     | 
    
         
            +
                minmax_by(:size, %w[a bb ccc]).should == %w[a ccc]
         
     | 
| 
      
 206 
     | 
    
         
            +
              end
         
     | 
| 
      
 207 
     | 
    
         
            +
            end
         
     | 
| 
      
 208 
     | 
    
         
            +
             
     | 
| 
      
 209 
     | 
    
         
            +
            describe 'Kernel.none?' do
         
     | 
| 
      
 210 
     | 
    
         
            +
              it 'should behave like Enumerable#none?' do
         
     | 
| 
      
 211 
     | 
    
         
            +
                none?([false, nil]).should be_true
         
     | 
| 
      
 212 
     | 
    
         
            +
              end
         
     | 
| 
      
 213 
     | 
    
         
            +
            end
         
     | 
| 
      
 214 
     | 
    
         
            +
             
     | 
| 
      
 215 
     | 
    
         
            +
            describe 'Kernel.one?' do
         
     | 
| 
      
 216 
     | 
    
         
            +
              it 'should behave like Enumerable#one?' do
         
     | 
| 
      
 217 
     | 
    
         
            +
                one?([true, false, nil]).should be_true
         
     | 
| 
      
 218 
     | 
    
         
            +
              end
         
     | 
| 
      
 219 
     | 
    
         
            +
            end
         
     | 
| 
      
 220 
     | 
    
         
            +
             
     | 
| 
      
 221 
     | 
    
         
            +
            describe 'Kernel.partition' do
         
     | 
| 
      
 222 
     | 
    
         
            +
              it 'should behave like Enumerable#partition' do
         
     | 
| 
      
 223 
     | 
    
         
            +
                partition(:odd?, 1..4).should == [[1, 3], [2, 4]]
         
     | 
| 
      
 224 
     | 
    
         
            +
              end
         
     | 
| 
      
 225 
     | 
    
         
            +
            end
         
     | 
| 
      
 226 
     | 
    
         
            +
             
     | 
| 
      
 227 
     | 
    
         
            +
            describe 'Kernel.reduce' do
         
     | 
| 
      
 228 
     | 
    
         
            +
              it 'should behave like Enumerable#reduce' do
         
     | 
| 
      
 229 
     | 
    
         
            +
                reduce(:-, 0, 1..3).should == -6
         
     | 
| 
      
 230 
     | 
    
         
            +
              end
         
     | 
| 
      
 231 
     | 
    
         
            +
            end
         
     | 
| 
      
 232 
     | 
    
         
            +
             
     | 
| 
      
 233 
     | 
    
         
            +
            describe 'Kernel.reject' do
         
     | 
| 
      
 234 
     | 
    
         
            +
              it 'should behave like Enumerable#reject' do
         
     | 
| 
      
 235 
     | 
    
         
            +
                reject(:odd?, 1..4).should == [2, 4]
         
     | 
| 
      
 236 
     | 
    
         
            +
              end
         
     | 
| 
      
 237 
     | 
    
         
            +
            end
         
     | 
| 
      
 238 
     | 
    
         
            +
             
     | 
| 
      
 239 
     | 
    
         
            +
            describe 'Kernel.reverse_each' do
         
     | 
| 
      
 240 
     | 
    
         
            +
              it 'should behave like Enumerable#reverse_each' do
         
     | 
| 
      
 241 
     | 
    
         
            +
                reverse_each([[3, 4], [1, 2]]).to_a.should == [[1, 2], [3, 4]]
         
     | 
| 
      
 242 
     | 
    
         
            +
              end
         
     | 
| 
      
 243 
     | 
    
         
            +
            end
         
     | 
| 
      
 244 
     | 
    
         
            +
             
     | 
| 
      
 245 
     | 
    
         
            +
            describe 'Kernel.select' do
         
     | 
| 
      
 246 
     | 
    
         
            +
              it 'should behave like Enumerable#select' do
         
     | 
| 
      
 247 
     | 
    
         
            +
                select(:even?, 1..4).should == [2, 4]
         
     | 
| 
      
 248 
     | 
    
         
            +
              end
         
     | 
| 
      
 249 
     | 
    
         
            +
            end
         
     | 
| 
      
 250 
     | 
    
         
            +
             
     | 
| 
      
 251 
     | 
    
         
            +
            describe 'Kernel.slice_before' do
         
     | 
| 
      
 252 
     | 
    
         
            +
              it 'should behave like Enumerable#slice_before' do
         
     | 
| 
      
 253 
     | 
    
         
            +
                slice_before(:even?, 1..4).to_a.should == [[1], [2, 3], [4]]
         
     | 
| 
      
 254 
     | 
    
         
            +
              end
         
     | 
| 
      
 255 
     | 
    
         
            +
            end
         
     | 
| 
      
 256 
     | 
    
         
            +
             
     | 
| 
      
 257 
     | 
    
         
            +
            describe 'Kernel.sort' do
         
     | 
| 
      
 258 
     | 
    
         
            +
              it 'should behave like Enumerable#sort' do
         
     | 
| 
      
 259 
     | 
    
         
            +
                sort([3, 2, 1]).should == [1, 2, 3]
         
     | 
| 
      
 260 
     | 
    
         
            +
              end
         
     | 
| 
      
 261 
     | 
    
         
            +
            end
         
     | 
| 
      
 262 
     | 
    
         
            +
             
     | 
| 
      
 263 
     | 
    
         
            +
            describe 'Kernel.sort_by' do
         
     | 
| 
      
 264 
     | 
    
         
            +
              it 'should behave like Enumerable#sort_by' do
         
     | 
| 
      
 265 
     | 
    
         
            +
                sort_by(:size, %w[ccc bb a]).should == %w[a bb ccc]
         
     | 
| 
      
 266 
     | 
    
         
            +
              end
         
     | 
| 
      
 267 
     | 
    
         
            +
            end
         
     | 
| 
      
 268 
     | 
    
         
            +
             
     | 
| 
      
 269 
     | 
    
         
            +
            describe 'Kernel.take' do
         
     | 
| 
      
 270 
     | 
    
         
            +
              it 'should behave like Enumerable#take' do
         
     | 
| 
      
 271 
     | 
    
         
            +
                take(2, 1..5).should == [1, 2]
         
     | 
| 
      
 272 
     | 
    
         
            +
              end
         
     | 
| 
      
 273 
     | 
    
         
            +
            end
         
     | 
| 
      
 274 
     | 
    
         
            +
             
     | 
| 
      
 275 
     | 
    
         
            +
            describe 'Kernel.take_while' do
         
     | 
| 
      
 276 
     | 
    
         
            +
              it 'should behave like Enumerable#take_while' do
         
     | 
| 
      
 277 
     | 
    
         
            +
                take_while(:even?, [2, 4, 5]).should == [2, 4]
         
     | 
| 
      
 278 
     | 
    
         
            +
              end
         
     | 
| 
      
 279 
     | 
    
         
            +
            end
         
     | 
| 
      
 280 
     | 
    
         
            +
             
     | 
| 
      
 281 
     | 
    
         
            +
            describe 'Kernel.to_a' do
         
     | 
| 
      
 282 
     | 
    
         
            +
              it 'should behave like Enumerable#to_a' do
         
     | 
| 
      
 283 
     | 
    
         
            +
                to_a(1..3).should == [1, 2, 3]
         
     | 
| 
      
 284 
     | 
    
         
            +
              end
         
     | 
| 
      
 285 
     | 
    
         
            +
            end
         
     | 
| 
      
 286 
     | 
    
         
            +
             
     | 
| 
      
 287 
     | 
    
         
            +
            describe 'Kernel.zip' do
         
     | 
| 
      
 288 
     | 
    
         
            +
              it 'should behave like Enumerable#zip' do
         
     | 
| 
      
 289 
     | 
    
         
            +
                zip([1, 2], [:a, :b]).should == [[:a, 1], [:b, 2]]
         
     | 
| 
      
 290 
     | 
    
         
            +
              end
         
     | 
| 
      
 291 
     | 
    
         
            +
            end
         
     | 
    
        data/spec/spec_helper.rb
    ADDED
    
    | 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require File.expand_path('../../lib/enumerabull', __FILE__)
         
     | 
    
        metadata
    ADDED
    
    | 
         @@ -0,0 +1,90 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification
         
     | 
| 
      
 2 
     | 
    
         
            +
            name: enumerabull
         
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.0.1
         
     | 
| 
      
 5 
     | 
    
         
            +
              prerelease: 
         
     | 
| 
      
 6 
     | 
    
         
            +
            platform: ruby
         
     | 
| 
      
 7 
     | 
    
         
            +
            authors:
         
     | 
| 
      
 8 
     | 
    
         
            +
            - Three If By Whiskey
         
     | 
| 
      
 9 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
      
 10 
     | 
    
         
            +
            bindir: bin
         
     | 
| 
      
 11 
     | 
    
         
            +
            cert_chain: []
         
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2014-02-09 00:00:00.000000000 Z
         
     | 
| 
      
 13 
     | 
    
         
            +
            dependencies:
         
     | 
| 
      
 14 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 15 
     | 
    
         
            +
              name: bundler
         
     | 
| 
      
 16 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 17 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 18 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 19 
     | 
    
         
            +
                - - ~>
         
     | 
| 
      
 20 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 21 
     | 
    
         
            +
                    version: '1.5'
         
     | 
| 
      
 22 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 23 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 24 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 25 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 26 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 27 
     | 
    
         
            +
                - - ~>
         
     | 
| 
      
 28 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 29 
     | 
    
         
            +
                    version: '1.5'
         
     | 
| 
      
 30 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 31 
     | 
    
         
            +
              name: rake
         
     | 
| 
      
 32 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 33 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 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 
     | 
    
         
            +
            description: 
         
     | 
| 
      
 47 
     | 
    
         
            +
            email:
         
     | 
| 
      
 48 
     | 
    
         
            +
            - 3ifbyw@gmail.com
         
     | 
| 
      
 49 
     | 
    
         
            +
            executables: []
         
     | 
| 
      
 50 
     | 
    
         
            +
            extensions: []
         
     | 
| 
      
 51 
     | 
    
         
            +
            extra_rdoc_files: []
         
     | 
| 
      
 52 
     | 
    
         
            +
            files:
         
     | 
| 
      
 53 
     | 
    
         
            +
            - Gemfile
         
     | 
| 
      
 54 
     | 
    
         
            +
            - LICENSE
         
     | 
| 
      
 55 
     | 
    
         
            +
            - README.md
         
     | 
| 
      
 56 
     | 
    
         
            +
            - Rakefile
         
     | 
| 
      
 57 
     | 
    
         
            +
            - enumerabull.gemspec
         
     | 
| 
      
 58 
     | 
    
         
            +
            - lib/enumerabull.rb
         
     | 
| 
      
 59 
     | 
    
         
            +
            - spec/enumerabull_spec.rb
         
     | 
| 
      
 60 
     | 
    
         
            +
            - spec/spec_helper.rb
         
     | 
| 
      
 61 
     | 
    
         
            +
            homepage: 
         
     | 
| 
      
 62 
     | 
    
         
            +
            licenses:
         
     | 
| 
      
 63 
     | 
    
         
            +
            - WTFPL
         
     | 
| 
      
 64 
     | 
    
         
            +
            post_install_message: 
         
     | 
| 
      
 65 
     | 
    
         
            +
            rdoc_options: []
         
     | 
| 
      
 66 
     | 
    
         
            +
            require_paths:
         
     | 
| 
      
 67 
     | 
    
         
            +
            - lib
         
     | 
| 
      
 68 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 69 
     | 
    
         
            +
              none: false
         
     | 
| 
      
 70 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 71 
     | 
    
         
            +
              - - ! '>='
         
     | 
| 
      
 72 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 73 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 74 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 75 
     | 
    
         
            +
              none: false
         
     | 
| 
      
 76 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 77 
     | 
    
         
            +
              - - ! '>='
         
     | 
| 
      
 78 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 79 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 80 
     | 
    
         
            +
            requirements: []
         
     | 
| 
      
 81 
     | 
    
         
            +
            rubyforge_project: 
         
     | 
| 
      
 82 
     | 
    
         
            +
            rubygems_version: 1.8.23
         
     | 
| 
      
 83 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
      
 84 
     | 
    
         
            +
            specification_version: 3
         
     | 
| 
      
 85 
     | 
    
         
            +
            summary: Enumerabull pollutes Kernelspace with inverted versions of Enumerable's instance
         
     | 
| 
      
 86 
     | 
    
         
            +
              methods. It's like unleashing a bull in your Ruby shop to get "functional programming".
         
     | 
| 
      
 87 
     | 
    
         
            +
            test_files:
         
     | 
| 
      
 88 
     | 
    
         
            +
            - enumerabull.gemspec
         
     | 
| 
      
 89 
     | 
    
         
            +
            - spec/enumerabull_spec.rb
         
     | 
| 
      
 90 
     | 
    
         
            +
            - spec/spec_helper.rb
         
     |