active_interaction 1.3.1 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -1
- data/README.md +1 -1
- data/lib/active_interaction.rb +1 -1
- data/lib/active_interaction/filters/array_filter.rb +17 -1
- data/lib/active_interaction/version.rb +1 -1
- metadata +1 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: a00db578594483e7fe73f362bee7f4d0ec7aebcf
         | 
| 4 | 
            +
              data.tar.gz: d666371074ab0a681edaf845663fc86ecb178b0f
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 87bc01ad6c2222511e233f5b67ee0a1d5b0778a4e1b64342c9f4637cce317a7e0e204c8a3639ef20cadc057265e130b68fe40b9ad006e36b545e72c9c7aacbdf
         | 
| 7 | 
            +
              data.tar.gz: d7d04bb2bbe7be1737427c7679712bc3ec3da22d26dc31ad2080930e4c52178118dffb44a5f3750eb789d0981056154c0b5a4ccc4a68141f2fa0e6c22f6ba81e
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -1,5 +1,11 @@ | |
| 1 1 | 
             
            # [Master][]
         | 
| 2 2 |  | 
| 3 | 
            +
            # [1.4.0][] (2014-12-10)
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            ## Changed
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            - [#239][]: Accept `ActiveRecord::Relation` objects as `array` inputs.
         | 
| 8 | 
            +
             | 
| 3 9 | 
             
            # [1.3.1][] (2014-12-10)
         | 
| 4 10 |  | 
| 5 11 | 
             
            ## Fixed
         | 
| @@ -354,7 +360,8 @@ | |
| 354 360 |  | 
| 355 361 | 
             
            - Initial release.
         | 
| 356 362 |  | 
| 357 | 
            -
              [master]: https://github.com/orgsync/active_interaction/compare/v1. | 
| 363 | 
            +
              [master]: https://github.com/orgsync/active_interaction/compare/v1.4.0...master
         | 
| 364 | 
            +
              [1.4.0]: https://github.com/orgsync/active_interaction/compare/v1.3.1...v1.4.0
         | 
| 358 365 | 
             
              [1.3.1]: https://github.com/orgsync/active_interaction/compare/v1.3.0...v1.3.1
         | 
| 359 366 | 
             
              [1.3.0]: https://github.com/orgsync/active_interaction/compare/v1.2.5...v1.3.0
         | 
| 360 367 | 
             
              [1.2.5]: https://github.com/orgsync/active_interaction/compare/v1.2.4...v1.2.5
         | 
| @@ -466,3 +473,4 @@ | |
| 466 473 | 
             
              [#207]: https://github.com/orgsync/active_interaction/issues/207
         | 
| 467 474 | 
             
              [#224]: https://github.com/orgsync/active_interaction/issues/224
         | 
| 468 475 | 
             
              [#235]: https://github.com/orgsync/active_interaction/issues/235
         | 
| 476 | 
            +
              [#239]: https://github.com/orgsync/active_interaction/issues/239
         | 
    
        data/README.md
    CHANGED
    
    
    
        data/lib/active_interaction.rb
    CHANGED
    
    
| @@ -1,5 +1,10 @@ | |
| 1 1 | 
             
            # coding: utf-8
         | 
| 2 2 |  | 
| 3 | 
            +
            begin
         | 
| 4 | 
            +
              require 'active_record'
         | 
| 5 | 
            +
            rescue LoadError
         | 
| 6 | 
            +
            end
         | 
| 7 | 
            +
             | 
| 3 8 | 
             
            module ActiveInteraction
         | 
| 4 9 | 
             
              class Base
         | 
| 5 10 | 
             
                # @!method self.array(*attributes, options = {}, &block)
         | 
| @@ -29,7 +34,7 @@ module ActiveInteraction | |
| 29 34 |  | 
| 30 35 | 
             
                def cast(value)
         | 
| 31 36 | 
             
                  case value
         | 
| 32 | 
            -
                  when  | 
| 37 | 
            +
                  when *classes
         | 
| 33 38 | 
             
                    return value if filters.empty?
         | 
| 34 39 |  | 
| 35 40 | 
             
                    filter = filters.values.first
         | 
| @@ -51,6 +56,17 @@ module ActiveInteraction | |
| 51 56 |  | 
| 52 57 | 
             
                private
         | 
| 53 58 |  | 
| 59 | 
            +
                # @return [Array<Class>]
         | 
| 60 | 
            +
                def classes
         | 
| 61 | 
            +
                  result = [Array]
         | 
| 62 | 
            +
             | 
| 63 | 
            +
                  if ActiveRecord.const_defined?(:Relation)
         | 
| 64 | 
            +
                    result.push(ActiveRecord::Relation)
         | 
| 65 | 
            +
                  end
         | 
| 66 | 
            +
             | 
| 67 | 
            +
                  result
         | 
| 68 | 
            +
                end
         | 
| 69 | 
            +
             | 
| 54 70 | 
             
                # @param filter [Filter]
         | 
| 55 71 | 
             
                # @param names [Array<Symbol>]
         | 
| 56 72 | 
             
                #
         |