totally_lazy 0.1.31 → 0.1.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
 - data/spec/totally_lazy/either_spec.rb +15 -0
 - metadata +1 -1
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,15 +1,15 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            !binary "U0hBMQ==":
         
     | 
| 
       3 
3 
     | 
    
         
             
              metadata.gz: !binary |-
         
     | 
| 
       4 
     | 
    
         
            -
                 
     | 
| 
      
 4 
     | 
    
         
            +
                ZWJhZWJjMGM0NzhhNTc0NTMzM2FiMDNkM2FiZTc2NzBmMTgyNzYwZg==
         
     | 
| 
       5 
5 
     | 
    
         
             
              data.tar.gz: !binary |-
         
     | 
| 
       6 
     | 
    
         
            -
                 
     | 
| 
      
 6 
     | 
    
         
            +
                ZDIwNmViZjk5OWUxZjY1MjUxMzMzZjljNjM2ZWVhNDY5OWFjMWUyOA==
         
     | 
| 
       7 
7 
     | 
    
         
             
            SHA512:
         
     | 
| 
       8 
8 
     | 
    
         
             
              metadata.gz: !binary |-
         
     | 
| 
       9 
     | 
    
         
            -
                 
     | 
| 
       10 
     | 
    
         
            -
                 
     | 
| 
       11 
     | 
    
         
            -
                 
     | 
| 
      
 9 
     | 
    
         
            +
                ZTI5YmRiMTc5MGIxMzUxMGRlNmY4MWJhMjA5ZTAyOGIxZmI5NGM0NjQzZDRl
         
     | 
| 
      
 10 
     | 
    
         
            +
                NGY5Y2Q3MWI5YzFkYmY2ZGFmNWJhZDhhZjVlYjRiZDU1ZTE0NDdhYWFkMWU5
         
     | 
| 
      
 11 
     | 
    
         
            +
                MjI1Zjg2MjQxMThiYTE4OTAyMWIzN2FjMzcxMWQxYTE4NmRhMTk=
         
     | 
| 
       12 
12 
     | 
    
         
             
              data.tar.gz: !binary |-
         
     | 
| 
       13 
     | 
    
         
            -
                 
     | 
| 
       14 
     | 
    
         
            -
                 
     | 
| 
       15 
     | 
    
         
            -
                 
     | 
| 
      
 13 
     | 
    
         
            +
                MjAxMjU5OWE5ODkyZWNhMzc4MDg4MzI3ZmUzZDA2MGFmNmFkOTIyMmE4ZDIz
         
     | 
| 
      
 14 
     | 
    
         
            +
                ZWEwY2IxMWRmN2QyMTQzNDNiZDY3NjYwMTNhMDNkZjJlN2QwZTI4NzQ5ZDkz
         
     | 
| 
      
 15 
     | 
    
         
            +
                YzRjZjIwYzFkNzA0Y2QyM2QxZTFkM2QyZWNmMWFmZTNiYmQwY2M=
         
     | 
| 
         @@ -3,6 +3,21 @@ 
     | 
|
| 
       3 
3 
     | 
    
         
             
            require_relative '../spec_helper'
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
            describe 'Either' do
         
     | 
| 
      
 6 
     | 
    
         
            +
              it 'should support creating rights' do
         
     | 
| 
      
 7 
     | 
    
         
            +
                either = right(3)
         
     | 
| 
      
 8 
     | 
    
         
            +
                expect(either.is_right?).to eq(true)
         
     | 
| 
      
 9 
     | 
    
         
            +
                expect(either.is_left?).to eq(false)
         
     | 
| 
      
 10 
     | 
    
         
            +
                expect(either.right_value).to eq(3)
         
     | 
| 
      
 11 
     | 
    
         
            +
              end
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
              it 'should support creating lefts' do
         
     | 
| 
      
 14 
     | 
    
         
            +
                exception = NoSuchElementException.new
         
     | 
| 
      
 15 
     | 
    
         
            +
                either = left(exception)
         
     | 
| 
      
 16 
     | 
    
         
            +
                expect(either.is_right?).to eq(false)
         
     | 
| 
      
 17 
     | 
    
         
            +
                expect(either.is_left?).to eq(true)
         
     | 
| 
      
 18 
     | 
    
         
            +
                expect(either.left_value).to eq(exception)
         
     | 
| 
      
 19 
     | 
    
         
            +
              end
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
       6 
21 
     | 
    
         
             
              it 'can be used in filter and map' do
         
     | 
| 
       7 
22 
     | 
    
         
             
                eithers = sequence(left('error'), right(3))
         
     | 
| 
       8 
23 
     | 
    
         
             
                expect(eithers.filter(is_left?).map(get_left)).to eq(sequence('error'))
         
     |