frozen_record 0.3.0 → 0.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/README.md +2 -1
 - data/frozen_record.gemspec +1 -1
 - data/lib/frozen_record/base.rb +1 -1
 - data/lib/frozen_record/scope.rb +4 -0
 - data/lib/frozen_record/version.rb +1 -1
 - data/spec/scope_spec.rb +22 -9
 - metadata +5 -4
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: adb5e89145c00c13f76483285346371896a49c1f
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: dbaa591c9cd948b6d4a63a41b742af908dbf0f9f
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: baacf19c3123b119826cf461249f880c55816c21125565e819f065d4b854bffd492f726ae5abf1a799f4de581e412266f207fce25cef30df784c164685f88518
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 5f4cc8959474d1fc41674537d09c786ec96c4098545a4e8a603fa4b9f04b4f8b215c8ab0775d04cceb3ed830b4e1e8197dee7501c5b14b34e88132f6cf259014
         
     | 
    
        data/README.md
    CHANGED
    
    
    
        data/frozen_record.gemspec
    CHANGED
    
    | 
         @@ -9,7 +9,7 @@ Gem::Specification.new do |spec| 
     | 
|
| 
       9 
9 
     | 
    
         
             
              spec.authors       = ['Jean Boussier']
         
     | 
| 
       10 
10 
     | 
    
         
             
              spec.email         = ['jean.boussier@gmail.com']
         
     | 
| 
       11 
11 
     | 
    
         
             
              spec.summary       = %q{ActiveRecord like interface to read only access and query static YAML files}
         
     | 
| 
       12 
     | 
    
         
            -
              spec.homepage      = ''
         
     | 
| 
      
 12 
     | 
    
         
            +
              spec.homepage      = 'https://github.com/byroot/frozen_record'
         
     | 
| 
       13 
13 
     | 
    
         
             
              spec.license       = 'MIT'
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
       15 
15 
     | 
    
         
             
              spec.files         = `git ls-files`.split($/)
         
     | 
    
        data/lib/frozen_record/base.rb
    CHANGED
    
    | 
         @@ -47,7 +47,7 @@ module FrozenRecord 
     | 
|
| 
       47 
47 
     | 
    
         
             
                    store[:scope] = scope
         
     | 
| 
       48 
48 
     | 
    
         
             
                  end
         
     | 
| 
       49 
49 
     | 
    
         | 
| 
       50 
     | 
    
         
            -
                  delegate :find, :find_by_id, :find_by, :find_by!, :where, :first, :first!, :last, :last!, :pluck, :order, :limit, :offset,
         
     | 
| 
      
 50 
     | 
    
         
            +
                  delegate :find, :find_by_id, :find_by, :find_by!, :where, :first, :first!, :last, :last!, :pluck, :ids, :order, :limit, :offset,
         
     | 
| 
       51 
51 
     | 
    
         
             
                           :minimum, :maximum, :average, :sum, to: :current_scope
         
     | 
| 
       52 
52 
     | 
    
         | 
| 
       53 
53 
     | 
    
         
             
                  def file_path
         
     | 
    
        data/lib/frozen_record/scope.rb
    CHANGED
    
    
    
        data/spec/scope_spec.rb
    CHANGED
    
    | 
         @@ -282,15 +282,6 @@ describe 'querying' do 
     | 
|
| 
       282 
282 
     | 
    
         | 
| 
       283 
283 
     | 
    
         
             
                end
         
     | 
| 
       284 
284 
     | 
    
         | 
| 
       285 
     | 
    
         
            -
                context 'when called with multiple arguments' do
         
     | 
| 
       286 
     | 
    
         
            -
             
     | 
| 
       287 
     | 
    
         
            -
                  it 'returns an array of arrays' do
         
     | 
| 
       288 
     | 
    
         
            -
                    names = Country.pluck(:id, :name)
         
     | 
| 
       289 
     | 
    
         
            -
                    expect(names).to be == [[1, 'Canada'], [2, 'France'], [3, 'Austria']]
         
     | 
| 
       290 
     | 
    
         
            -
                  end
         
     | 
| 
       291 
     | 
    
         
            -
             
     | 
| 
       292 
     | 
    
         
            -
                end
         
     | 
| 
       293 
     | 
    
         
            -
             
     | 
| 
       294 
285 
     | 
    
         
             
                context 'when called without arguments' do
         
     | 
| 
       295 
286 
     | 
    
         | 
| 
       296 
287 
     | 
    
         
             
                  pending 'returns an array of arrays containing all attributes in order'
         
     | 
| 
         @@ -308,6 +299,28 @@ describe 'querying' do 
     | 
|
| 
       308 
299 
     | 
    
         | 
| 
       309 
300 
     | 
    
         
             
              end
         
     | 
| 
       310 
301 
     | 
    
         | 
| 
      
 302 
     | 
    
         
            +
              describe '.ids' do
         
     | 
| 
      
 303 
     | 
    
         
            +
             
     | 
| 
      
 304 
     | 
    
         
            +
                context 'when called with no arguments' do
         
     | 
| 
      
 305 
     | 
    
         
            +
             
     | 
| 
      
 306 
     | 
    
         
            +
                  it 'returns an array of ids' do
         
     | 
| 
      
 307 
     | 
    
         
            +
                    ids = Country.ids
         
     | 
| 
      
 308 
     | 
    
         
            +
                    expect(ids).to be == [1, 2, 3]
         
     | 
| 
      
 309 
     | 
    
         
            +
                  end
         
     | 
| 
      
 310 
     | 
    
         
            +
             
     | 
| 
      
 311 
     | 
    
         
            +
                end
         
     | 
| 
      
 312 
     | 
    
         
            +
             
     | 
| 
      
 313 
     | 
    
         
            +
                context 'when called on a scope' do
         
     | 
| 
      
 314 
     | 
    
         
            +
             
     | 
| 
      
 315 
     | 
    
         
            +
                  it 'returns only the ids of matching records' do
         
     | 
| 
      
 316 
     | 
    
         
            +
                    ids = Country.where(capital: "Ottawa").ids
         
     | 
| 
      
 317 
     | 
    
         
            +
                    expect(ids).to be == [1]
         
     | 
| 
      
 318 
     | 
    
         
            +
                  end
         
     | 
| 
      
 319 
     | 
    
         
            +
             
     | 
| 
      
 320 
     | 
    
         
            +
                end
         
     | 
| 
      
 321 
     | 
    
         
            +
             
     | 
| 
      
 322 
     | 
    
         
            +
              end
         
     | 
| 
      
 323 
     | 
    
         
            +
             
     | 
| 
       311 
324 
     | 
    
         
             
              describe '.exists?' do
         
     | 
| 
       312 
325 
     | 
    
         | 
| 
       313 
326 
     | 
    
         
             
                it 'returns true if query match at least one record' do
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: frozen_record
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.4.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Jean Boussier
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date:  
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2015-05-06 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: activemodel
         
     | 
| 
         @@ -120,7 +120,7 @@ files: 
     | 
|
| 
       120 
120 
     | 
    
         
             
            - spec/spec_helper.rb
         
     | 
| 
       121 
121 
     | 
    
         
             
            - spec/support/car.rb
         
     | 
| 
       122 
122 
     | 
    
         
             
            - spec/support/country.rb
         
     | 
| 
       123 
     | 
    
         
            -
            homepage:  
     | 
| 
      
 123 
     | 
    
         
            +
            homepage: https://github.com/byroot/frozen_record
         
     | 
| 
       124 
124 
     | 
    
         
             
            licenses:
         
     | 
| 
       125 
125 
     | 
    
         
             
            - MIT
         
     | 
| 
       126 
126 
     | 
    
         
             
            metadata: {}
         
     | 
| 
         @@ -140,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       140 
140 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       141 
141 
     | 
    
         
             
            requirements: []
         
     | 
| 
       142 
142 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       143 
     | 
    
         
            -
            rubygems_version: 2. 
     | 
| 
      
 143 
     | 
    
         
            +
            rubygems_version: 2.4.6
         
     | 
| 
       144 
144 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       145 
145 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       146 
146 
     | 
    
         
             
            summary: ActiveRecord like interface to read only access and query static YAML files
         
     | 
| 
         @@ -152,3 +152,4 @@ test_files: 
     | 
|
| 
       152 
152 
     | 
    
         
             
            - spec/spec_helper.rb
         
     | 
| 
       153 
153 
     | 
    
         
             
            - spec/support/car.rb
         
     | 
| 
       154 
154 
     | 
    
         
             
            - spec/support/country.rb
         
     | 
| 
      
 155 
     | 
    
         
            +
            has_rdoc: 
         
     |