state_of_the_nation 1.0.0 → 1.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.
- checksums.yaml +4 -4
 - data/README.md +19 -7
 - data/lib/state_of_the_nation/version.rb +1 -1
 - data/state_of_the_nation.gemspec +3 -3
 - metadata +10 -10
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 72a6818e2ace1bf60670b197c86a09d4dc925ed5
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: bb28045766320c669452430634fe58cfda921304
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: ec3602725f892040ae4c022a68b85b0a35e8efc5c3126818769a390ce6fc253dd8d9c3bf7db2dbbed0668c38ff15f1044d139c1da26d4d15827a324bd11c963c
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: a2afdc5264ef33b14dfe0a82f1c5ee03c260174bca002c634663ac885dbf0c60731d028757a3ce8be6b922ae341c2c7c610f998851be28bfe4a447d9b5056368
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -1,8 +1,10 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # StateOfTheNation
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
      
 3 
     | 
    
         
            +
            [](https://travis-ci.com/intercom/state_of_the_nation)
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
      
 5 
     | 
    
         
            +
            StateOfTheNation makes modeling state that changes over time easy with ActiveRecord, allowing you to query the active value at any point in time, as well as ensure that your records don't overlap at any point.
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            Take for example modeling the history of elected officials in the United States Government where multiple Senators and only one President may be "active" for any point in time. Modeling this with StateOfTheNation is easy like so:
         
     | 
| 
       6 
8 
     | 
    
         | 
| 
       7 
9 
     | 
    
         
             
            ```ruby
         
     | 
| 
       8 
10 
     | 
    
         
             
            class Country < ActiveRecord::Base
         
     | 
| 
         @@ -24,19 +26,29 @@ class Senator < ActiveRecord::Base 
     | 
|
| 
       24 
26 
     | 
    
         
             
              considered_active.from(:entered_office_at).until(:left_office_at)
         
     | 
| 
       25 
27 
     | 
    
         
             
            end
         
     | 
| 
       26 
28 
     | 
    
         | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
       27 
30 
     | 
    
         
             
            ```
         
     | 
| 
       28 
31 
     | 
    
         | 
| 
       29 
32 
     | 
    
         
             
            With this collection of models we can easy record and query the list of elected officials at any point in time, and be confident that any new records that we create don't collide.
         
     | 
| 
       30 
33 
     | 
    
         | 
| 
       31 
34 
     | 
    
         
             
            ```ruby
         
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
            usa = Country.create(name: "United States of America")
         
     | 
| 
      
 37 
     | 
    
         
            +
            obama = usa.presidents.create!(entered_office_at: Date.new(2009, 1, 20), left_office_at: nil)
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
            wyden = usa.senators.create!(entered_office_at: Date.new(1996, 2, 6), left_office_at: nil, name: "Ron Wyden")
         
     | 
| 
      
 40 
     | 
    
         
            +
            boxer = usa.senators.create!(entered_office_at: Date.new(1993, 1, 3), left_office_at: nil, name: "Barbara Boxer")
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
            usa.active_president(Date.new(2015, 1, 1)) 
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
       33 
44 
     | 
    
         
             
            # => President(id: 1, name: "Barack Obama")
         
     | 
| 
       34 
45 
     | 
    
         | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
      
 46 
     | 
    
         
            +
            usa.active_senators(Date.new(2015, 1, 1))
         
     | 
| 
       36 
47 
     | 
    
         
             
            # => [
         
     | 
| 
       37 
     | 
    
         
            -
            Senator(id: 1, name: "Ron Wyden"),
         
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
      
 48 
     | 
    
         
            +
            # Senator(id: 1, name: "Ron Wyden"),
         
     | 
| 
      
 49 
     | 
    
         
            +
            # Senator(id: 2, name: "Barbara Boxer")
         
     | 
| 
      
 50 
     | 
    
         
            +
            # ...
         
     | 
| 
      
 51 
     | 
    
         
            +
            # ]
         
     | 
| 
       40 
52 
     | 
    
         | 
| 
       41 
53 
     | 
    
         | 
| 
       42 
54 
     | 
    
         
             
            ```
         
     | 
    
        data/state_of_the_nation.gemspec
    CHANGED
    
    | 
         @@ -9,7 +9,7 @@ Gem::Specification.new do |spec| 
     | 
|
| 
       9 
9 
     | 
    
         
             
              spec.authors       = ["Patrick O'Doherty", "Stephen O'Brien"]
         
     | 
| 
       10 
10 
     | 
    
         
             
              spec.email         = ["patrick@intercom.io", "stephen@intercom.io"]
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
              spec.summary       = %q{An easy way to model state changes over time}
         
     | 
| 
      
 12 
     | 
    
         
            +
              spec.summary       = %q{An easy way to model state that changes over time with ActiveRecord}
         
     | 
| 
       13 
13 
     | 
    
         
             
              spec.description   = %q{State of the Nation makes modeling object history easy.}
         
     | 
| 
       14 
14 
     | 
    
         
             
              spec.homepage      = "https://github.com/intercom/state_of_the_nation"
         
     | 
| 
       15 
15 
     | 
    
         
             
              spec.licenses      = ["Apache License, Version 2.0"]
         
     | 
| 
         @@ -32,6 +32,6 @@ Gem::Specification.new do |spec| 
     | 
|
| 
       32 
32 
     | 
    
         
             
              spec.add_development_dependency "shoulda-matchers"
         
     | 
| 
       33 
33 
     | 
    
         
             
              spec.add_development_dependency "sqlite3"
         
     | 
| 
       34 
34 
     | 
    
         | 
| 
       35 
     | 
    
         
            -
              spec.add_runtime_dependency "activesupport", " 
     | 
| 
       36 
     | 
    
         
            -
              spec.add_runtime_dependency "activerecord", " 
     | 
| 
      
 35 
     | 
    
         
            +
              spec.add_runtime_dependency "activesupport", ">= 4.0.0"
         
     | 
| 
      
 36 
     | 
    
         
            +
              spec.add_runtime_dependency "activerecord", ">= 4.0.0"
         
     | 
| 
       37 
37 
     | 
    
         
             
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: state_of_the_nation
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.0.1
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Patrick O'Doherty
         
     | 
| 
         @@ -141,30 +141,30 @@ dependencies: 
     | 
|
| 
       141 
141 
     | 
    
         
             
              name: activesupport
         
     | 
| 
       142 
142 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       143 
143 
     | 
    
         
             
                requirements:
         
     | 
| 
       144 
     | 
    
         
            -
                - - " 
     | 
| 
      
 144 
     | 
    
         
            +
                - - ">="
         
     | 
| 
       145 
145 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       146 
     | 
    
         
            -
                    version:  
     | 
| 
      
 146 
     | 
    
         
            +
                    version: 4.0.0
         
     | 
| 
       147 
147 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       148 
148 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       149 
149 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       150 
150 
     | 
    
         
             
                requirements:
         
     | 
| 
       151 
     | 
    
         
            -
                - - " 
     | 
| 
      
 151 
     | 
    
         
            +
                - - ">="
         
     | 
| 
       152 
152 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       153 
     | 
    
         
            -
                    version:  
     | 
| 
      
 153 
     | 
    
         
            +
                    version: 4.0.0
         
     | 
| 
       154 
154 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       155 
155 
     | 
    
         
             
              name: activerecord
         
     | 
| 
       156 
156 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       157 
157 
     | 
    
         
             
                requirements:
         
     | 
| 
       158 
     | 
    
         
            -
                - - " 
     | 
| 
      
 158 
     | 
    
         
            +
                - - ">="
         
     | 
| 
       159 
159 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       160 
     | 
    
         
            -
                    version:  
     | 
| 
      
 160 
     | 
    
         
            +
                    version: 4.0.0
         
     | 
| 
       161 
161 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       162 
162 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       163 
163 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       164 
164 
     | 
    
         
             
                requirements:
         
     | 
| 
       165 
     | 
    
         
            -
                - - " 
     | 
| 
      
 165 
     | 
    
         
            +
                - - ">="
         
     | 
| 
       166 
166 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       167 
     | 
    
         
            -
                    version:  
     | 
| 
      
 167 
     | 
    
         
            +
                    version: 4.0.0
         
     | 
| 
       168 
168 
     | 
    
         
             
            description: State of the Nation makes modeling object history easy.
         
     | 
| 
       169 
169 
     | 
    
         
             
            email:
         
     | 
| 
       170 
170 
     | 
    
         
             
            - patrick@intercom.io
         
     | 
| 
         @@ -210,6 +210,6 @@ rubyforge_project: 
     | 
|
| 
       210 
210 
     | 
    
         
             
            rubygems_version: 2.2.5
         
     | 
| 
       211 
211 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       212 
212 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       213 
     | 
    
         
            -
            summary: An easy way to model state changes over time
         
     | 
| 
      
 213 
     | 
    
         
            +
            summary: An easy way to model state that changes over time with ActiveRecord
         
     | 
| 
       214 
214 
     | 
    
         
             
            test_files: []
         
     | 
| 
       215 
215 
     | 
    
         
             
            has_rdoc: 
         
     |