acts_as_array 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.
- checksums.yaml +7 -0
 - data/.gitignore +10 -0
 - data/.travis.yml +8 -0
 - data/CHANGELOG.md +3 -0
 - data/Gemfile +6 -0
 - data/LICENSE +22 -0
 - data/README.md +140 -0
 - data/Rakefile +19 -0
 - data/acts_as_array.gemspec +25 -0
 - data/db/migrate/001_create_users.rb +13 -0
 - data/db/migrate/002_create_mails.rb +14 -0
 - data/db/migrate/003_create_phones.rb +14 -0
 - data/db/schema.rb +35 -0
 - data/lib/acts_as_array.rb +60 -0
 - data/spec/acts_as_array_spec.rb +75 -0
 - data/spec/migrate_tasks.rb +43 -0
 - data/spec/model.rb +30 -0
 - data/spec/spec_helper.rb +19 -0
 - metadata +121 -0
 
    
        checksums.yaml
    ADDED
    
    | 
         @@ -0,0 +1,7 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ---
         
     | 
| 
      
 2 
     | 
    
         
            +
            SHA1:
         
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 120a75d054520211cc914c9fd78ad4f1462fb23a
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 8477ac317dacdd580e5d36ff6eea21c8b544ec90
         
     | 
| 
      
 5 
     | 
    
         
            +
            SHA512:
         
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: a29c33a7618a5e1533e6b58a801ecda5e5cbe0289be94574e6a715eb2b1bb1f9172179f6b8b84be3c46bac64544b9ea7c5fd2866a7f67a1a9721cc7a149c6086
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: fa00f4b6bc2a105237c77d1b5c441e8973699eb423ba1e1fbede0eecf5e44a2cf2f50cd67187c629b492b878da2808cee1d22065b28a2743de83b24c6f03f1f4
         
     | 
    
        data/.gitignore
    ADDED
    
    
    
        data/.travis.yml
    ADDED
    
    
    
        data/CHANGELOG.md
    ADDED
    
    
    
        data/Gemfile
    ADDED
    
    
    
        data/LICENSE
    ADDED
    
    | 
         @@ -0,0 +1,22 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            Copyright (c) 2014 Naotoshi Seo
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            MIT License
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            Permission is hereby granted, free of charge, to any person obtaining
         
     | 
| 
      
 6 
     | 
    
         
            +
            a copy of this software and associated documentation files (the
         
     | 
| 
      
 7 
     | 
    
         
            +
            "Software"), to deal in the Software without restriction, including
         
     | 
| 
      
 8 
     | 
    
         
            +
            without limitation the rights to use, copy, modify, merge, publish,
         
     | 
| 
      
 9 
     | 
    
         
            +
            distribute, sublicense, and/or sell copies of the Software, and to
         
     | 
| 
      
 10 
     | 
    
         
            +
            permit persons to whom the Software is furnished to do so, subject to
         
     | 
| 
      
 11 
     | 
    
         
            +
            the following conditions:
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            The above copyright notice and this permission notice shall be
         
     | 
| 
      
 14 
     | 
    
         
            +
            included in all copies or substantial portions of the Software.
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
         
     | 
| 
      
 17 
     | 
    
         
            +
            EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
         
     | 
| 
      
 18 
     | 
    
         
            +
            MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
         
     | 
| 
      
 19 
     | 
    
         
            +
            NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
         
     | 
| 
      
 20 
     | 
    
         
            +
            LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
         
     | 
| 
      
 21 
     | 
    
         
            +
            OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
         
     | 
| 
      
 22 
     | 
    
         
            +
            WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
         
     | 
    
        data/README.md
    ADDED
    
    | 
         @@ -0,0 +1,140 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # Acts as array
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            `acts_as_array` makes possible to treat your array fields simply.
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            [](https://travis-ci.org/sonots/acts_as_array)
         
     | 
| 
      
 6 
     | 
    
         
            +
            [](https://coveralls.io/r/sonots/acts_as_array)
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            ## Installation
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            Add the following to your `Gemfile`:
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 13 
     | 
    
         
            +
            gem 'acts_as_array'
         
     | 
| 
      
 14 
     | 
    
         
            +
            ```
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            And then execute:
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            ```plain
         
     | 
| 
      
 19 
     | 
    
         
            +
            $ bundle
         
     | 
| 
      
 20 
     | 
    
         
            +
            ```
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
            ## What is this for?
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
            Say an user has multiple mail addresses. Typically you will define table schema as:
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 27 
     | 
    
         
            +
            create_table :users do |t|
         
     | 
| 
      
 28 
     | 
    
         
            +
              t.string :name
         
     | 
| 
      
 29 
     | 
    
         
            +
            end
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
            create_table :mails do |t|
         
     | 
| 
      
 32 
     | 
    
         
            +
              t.string :address
         
     | 
| 
      
 33 
     | 
    
         
            +
              t.references :user
         
     | 
| 
      
 34 
     | 
    
         
            +
            end
         
     | 
| 
      
 35 
     | 
    
         
            +
            ```
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
            And, define ActiveRecord models as:
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 40 
     | 
    
         
            +
            class Mail < ActiveRecord::Base
         
     | 
| 
      
 41 
     | 
    
         
            +
              belongs_to :user
         
     | 
| 
      
 42 
     | 
    
         
            +
            end
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
            class User < ActiveRecord::Base
         
     | 
| 
      
 45 
     | 
    
         
            +
              has_many :mails
         
     | 
| 
      
 46 
     | 
    
         
            +
            end
         
     | 
| 
      
 47 
     | 
    
         
            +
            ```
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
            In this case, you will store multiple mail addresses to an users like:
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 52 
     | 
    
         
            +
            ichiro = User.new(name: 'Ichiro')
         
     | 
| 
      
 53 
     | 
    
         
            +
            ichiro.mails = [Mail.new(address: 'ichiro@example.com'), Mail.new(address: 'ichiro2@example.com')]
         
     | 
| 
      
 54 
     | 
    
         
            +
            ichiro.save
         
     | 
| 
      
 55 
     | 
    
         
            +
            ```
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
            But, you want to set multiple mail addresses simply like followings?:
         
     | 
| 
      
 58 
     | 
    
         
            +
             
     | 
| 
      
 59 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 60 
     | 
    
         
            +
            ichiro = User.new(name: 'Ichiro')
         
     | 
| 
      
 61 
     | 
    
         
            +
            ichiro.mails = ['ichiro@example.com', 'ichiro2@example.com']
         
     | 
| 
      
 62 
     | 
    
         
            +
            ichiro.save
         
     | 
| 
      
 63 
     | 
    
         
            +
            ```
         
     | 
| 
      
 64 
     | 
    
         
            +
             
     | 
| 
      
 65 
     | 
    
         
            +
            Then, `acts_as_array` is available for you. 
         
     | 
| 
      
 66 
     | 
    
         
            +
             
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
      
 68 
     | 
    
         
            +
            ### With acts_as_array
         
     | 
| 
      
 69 
     | 
    
         
            +
             
     | 
| 
      
 70 
     | 
    
         
            +
            Use `acts_as_array` as:
         
     | 
| 
      
 71 
     | 
    
         
            +
             
     | 
| 
      
 72 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 73 
     | 
    
         
            +
            class Mail < ActiveRecord::Base
         
     | 
| 
      
 74 
     | 
    
         
            +
              belongs_to :user
         
     | 
| 
      
 75 
     | 
    
         
            +
            end
         
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
      
 77 
     | 
    
         
            +
            require 'acts_as_array'
         
     | 
| 
      
 78 
     | 
    
         
            +
            class User < ActiveRecord::Base
         
     | 
| 
      
 79 
     | 
    
         
            +
              has_many :mails
         
     | 
| 
      
 80 
     | 
    
         
            +
              include ActsAsArray
         
     | 
| 
      
 81 
     | 
    
         
            +
              acts_as_array :mails => {:class => Mail, :field => :address} 
         
     | 
| 
      
 82 
     | 
    
         
            +
            end
         
     | 
| 
      
 83 
     | 
    
         
            +
            ```
         
     | 
| 
      
 84 
     | 
    
         
            +
             
     | 
| 
      
 85 
     | 
    
         
            +
            Then, it makes possible to set and get non-object array values like:
         
     | 
| 
      
 86 
     | 
    
         
            +
             
     | 
| 
      
 87 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 88 
     | 
    
         
            +
            ichiro = User.new(name: 'Ichiro')
         
     | 
| 
      
 89 
     | 
    
         
            +
            ichiro.mails = ['ichiro@example.com', 'ichiro2@example.com']
         
     | 
| 
      
 90 
     | 
    
         
            +
            ichiro.save
         
     | 
| 
      
 91 
     | 
    
         
            +
            User.first.mails #=> ['ichiro@example.com', 'ichiro2@example.com']
         
     | 
| 
      
 92 
     | 
    
         
            +
            ```
         
     | 
| 
      
 93 
     | 
    
         
            +
             
     | 
| 
      
 94 
     | 
    
         
            +
            You can also get the original object array values with:
         
     | 
| 
      
 95 
     | 
    
         
            +
             
     | 
| 
      
 96 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 97 
     | 
    
         
            +
            ichiro.obj_mails #=> [Mail.new(address: 'ichiro@example.com'), Mail.new(address: 'ichiro2@example.com')]
         
     | 
| 
      
 98 
     | 
    
         
            +
            ```
         
     | 
| 
      
 99 
     | 
    
         
            +
             
     | 
| 
      
 100 
     | 
    
         
            +
            ## Supported methods
         
     | 
| 
      
 101 
     | 
    
         
            +
             
     | 
| 
      
 102 
     | 
    
         
            +
            Following ActiveRecord methods are supported to specify non-object array values:
         
     | 
| 
      
 103 
     | 
    
         
            +
             
     | 
| 
      
 104 
     | 
    
         
            +
            * create
         
     | 
| 
      
 105 
     | 
    
         
            +
             
     | 
| 
      
 106 
     | 
    
         
            +
              `create(field: non_object_array)`
         
     | 
| 
      
 107 
     | 
    
         
            +
             
     | 
| 
      
 108 
     | 
    
         
            +
            * update_attributes
         
     | 
| 
      
 109 
     | 
    
         
            +
             
     | 
| 
      
 110 
     | 
    
         
            +
               `update_attributes(field: non_object_array)`
         
     | 
| 
      
 111 
     | 
    
         
            +
             
     | 
| 
      
 112 
     | 
    
         
            +
            * update
         
     | 
| 
      
 113 
     | 
    
         
            +
             
     | 
| 
      
 114 
     | 
    
         
            +
               `update(field: non_object_array)`
         
     | 
| 
      
 115 
     | 
    
         
            +
             
     | 
| 
      
 116 
     | 
    
         
            +
            * {field}=
         
     | 
| 
      
 117 
     | 
    
         
            +
             
     | 
| 
      
 118 
     | 
    
         
            +
               `{field} = non_object_array`
         
     | 
| 
      
 119 
     | 
    
         
            +
             
     | 
| 
      
 120 
     | 
    
         
            +
            Also, following getter methods are available:
         
     | 
| 
      
 121 
     | 
    
         
            +
             
     | 
| 
      
 122 
     | 
    
         
            +
            * {field}
         
     | 
| 
      
 123 
     | 
    
         
            +
             
     | 
| 
      
 124 
     | 
    
         
            +
              Return non-object array values
         
     | 
| 
      
 125 
     | 
    
         
            +
             
     | 
| 
      
 126 
     | 
    
         
            +
            * obj_{field}
         
     | 
| 
      
 127 
     | 
    
         
            +
             
     | 
| 
      
 128 
     | 
    
         
            +
              Return object array values
         
     | 
| 
      
 129 
     | 
    
         
            +
             
     | 
| 
      
 130 
     | 
    
         
            +
            ## Contributing
         
     | 
| 
      
 131 
     | 
    
         
            +
             
     | 
| 
      
 132 
     | 
    
         
            +
            1. Fork it
         
     | 
| 
      
 133 
     | 
    
         
            +
            2. Create your feature branch (`git checkout -b my-new-feature`)
         
     | 
| 
      
 134 
     | 
    
         
            +
            3. Commit your changes (`git commit -am 'Add some feature'`)
         
     | 
| 
      
 135 
     | 
    
         
            +
            4. Push to the branch (`git push origin my-new-feature`)
         
     | 
| 
      
 136 
     | 
    
         
            +
            5. Create new Pull Request
         
     | 
| 
      
 137 
     | 
    
         
            +
             
     | 
| 
      
 138 
     | 
    
         
            +
            ## Copyright
         
     | 
| 
      
 139 
     | 
    
         
            +
             
     | 
| 
      
 140 
     | 
    
         
            +
            * Copyright (c) 2014 Naotoshi Seo. See [LICENSE](LICENSE) for details.
         
     | 
    
        data/Rakefile
    ADDED
    
    | 
         @@ -0,0 +1,19 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # coding: utf-8
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'bundler/gem_tasks'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            require 'rspec/core/rake_task'
         
     | 
| 
      
 5 
     | 
    
         
            +
            RSpec::Core::RakeTask.new(:spec) do |t|
         
     | 
| 
      
 6 
     | 
    
         
            +
                t.rspec_opts = ["-c", "-f progress"] # '--format specdoc'
         
     | 
| 
      
 7 
     | 
    
         
            +
                  t.pattern = 'spec/**/*_spec.rb'
         
     | 
| 
      
 8 
     | 
    
         
            +
            end
         
     | 
| 
      
 9 
     | 
    
         
            +
            task :test => :spec
         
     | 
| 
      
 10 
     | 
    
         
            +
            task :default => :spec
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            desc 'Open an irb session preloaded with the gem library'
         
     | 
| 
      
 13 
     | 
    
         
            +
            task :console do
         
     | 
| 
      
 14 
     | 
    
         
            +
              sh 'irb -rubygems -I lib -I spec -r acts_as_array -r spec_helper -r model'
         
     | 
| 
      
 15 
     | 
    
         
            +
            end
         
     | 
| 
      
 16 
     | 
    
         
            +
            task :c => :console
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            $LOAD_PATH.unshift(File.dirname(__FILE__) + '/spec')
         
     | 
| 
      
 19 
     | 
    
         
            +
            require 'migrate_tasks'
         
     | 
| 
         @@ -0,0 +1,25 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #!/usr/bin/env gem build
         
     | 
| 
      
 2 
     | 
    
         
            +
            # encoding: utf-8
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            Gem::Specification.new do |s|
         
     | 
| 
      
 5 
     | 
    
         
            +
              s.name          = "acts_as_array"
         
     | 
| 
      
 6 
     | 
    
         
            +
              s.authors       = ["Naotoshi Seo"]
         
     | 
| 
      
 7 
     | 
    
         
            +
              s.email         = ["sonots@gmail.com"]
         
     | 
| 
      
 8 
     | 
    
         
            +
              s.homepage      = "https://github.com/sonots/acts_as_array"
         
     | 
| 
      
 9 
     | 
    
         
            +
              s.summary       = "Treat array fields simply"
         
     | 
| 
      
 10 
     | 
    
         
            +
              s.description   = "Treat array fields simply."
         
     | 
| 
      
 11 
     | 
    
         
            +
              s.version       = '0.0.1'
         
     | 
| 
      
 12 
     | 
    
         
            +
              s.date          = Time.now.strftime("%Y-%m-%d")
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
              s.extra_rdoc_files = Dir["*.rdoc"]
         
     | 
| 
      
 15 
     | 
    
         
            +
              s.files         = `git ls-files`.split($\)
         
     | 
| 
      
 16 
     | 
    
         
            +
              s.test_files    = s.files.grep(%r{^(test|spec|features)/})
         
     | 
| 
      
 17 
     | 
    
         
            +
              s.executables   = s.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
         
     | 
| 
      
 18 
     | 
    
         
            +
              s.require_paths = ["lib"]
         
     | 
| 
      
 19 
     | 
    
         
            +
              s.rdoc_options  = ["--charset=UTF-8"]
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
              s.add_development_dependency 'rspec'
         
     | 
| 
      
 22 
     | 
    
         
            +
              s.add_development_dependency 'rake'
         
     | 
| 
      
 23 
     | 
    
         
            +
              s.add_development_dependency 'pry'
         
     | 
| 
      
 24 
     | 
    
         
            +
              s.add_development_dependency 'pry-nav'
         
     | 
| 
      
 25 
     | 
    
         
            +
            end
         
     | 
    
        data/db/schema.rb
    ADDED
    
    | 
         @@ -0,0 +1,35 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # This file is auto-generated from the current state of the database. Instead
         
     | 
| 
      
 2 
     | 
    
         
            +
            # of editing this file, please use the migrations feature of Active Record to
         
     | 
| 
      
 3 
     | 
    
         
            +
            # incrementally modify your database, and then regenerate this schema definition.
         
     | 
| 
      
 4 
     | 
    
         
            +
            #
         
     | 
| 
      
 5 
     | 
    
         
            +
            # Note that this schema.rb definition is the authoritative source for your
         
     | 
| 
      
 6 
     | 
    
         
            +
            # database schema. If you need to create the application database on another
         
     | 
| 
      
 7 
     | 
    
         
            +
            # system, you should be using db:schema:load, not running all the migrations
         
     | 
| 
      
 8 
     | 
    
         
            +
            # from scratch. The latter is a flawed and unsustainable approach (the more migrations
         
     | 
| 
      
 9 
     | 
    
         
            +
            # you'll amass, the slower it'll run and the greater likelihood for issues).
         
     | 
| 
      
 10 
     | 
    
         
            +
            #
         
     | 
| 
      
 11 
     | 
    
         
            +
            # It's strongly recommended that you check this file into your version control system.
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            ActiveRecord::Schema.define(version: 3) do
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
              create_table "mails", force: true do |t|
         
     | 
| 
      
 16 
     | 
    
         
            +
                t.string  "name"
         
     | 
| 
      
 17 
     | 
    
         
            +
                t.integer "user_id"
         
     | 
| 
      
 18 
     | 
    
         
            +
              end
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
              add_index "mails", ["name"], name: "index_mails_on_name", unique: true
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
              create_table "phones", force: true do |t|
         
     | 
| 
      
 23 
     | 
    
         
            +
                t.string  "name"
         
     | 
| 
      
 24 
     | 
    
         
            +
                t.integer "user_id"
         
     | 
| 
      
 25 
     | 
    
         
            +
              end
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
              add_index "phones", ["name"], name: "index_phones_on_name", unique: true
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
              create_table "users", force: true do |t|
         
     | 
| 
      
 30 
     | 
    
         
            +
                t.string "name"
         
     | 
| 
      
 31 
     | 
    
         
            +
              end
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
              add_index "users", ["name"], name: "index_users_on_name", unique: true
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,60 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module ActsAsArray
         
     | 
| 
      
 2 
     | 
    
         
            +
              def self.included(klass)
         
     | 
| 
      
 3 
     | 
    
         
            +
                klass.extend(ClassMethods)
         
     | 
| 
      
 4 
     | 
    
         
            +
              end
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
              module ClassMethods
         
     | 
| 
      
 7 
     | 
    
         
            +
                # acts_as_array :has_many_field => {:class => Class, :field => :name}
         
     | 
| 
      
 8 
     | 
    
         
            +
                def acts_as_array(params = {})
         
     | 
| 
      
 9 
     | 
    
         
            +
                  self.class_eval do
         
     | 
| 
      
 10 
     | 
    
         
            +
                    params.each do |field, opts|
         
     | 
| 
      
 11 
     | 
    
         
            +
                      # xxxx = raw_array #=> obj_array
         
     | 
| 
      
 12 
     | 
    
         
            +
                      #
         
     | 
| 
      
 13 
     | 
    
         
            +
                      # Example:
         
     | 
| 
      
 14 
     | 
    
         
            +
                      #
         
     | 
| 
      
 15 
     | 
    
         
            +
                      # mails = ['a@a.com', 'b@b.com']
         
     | 
| 
      
 16 
     | 
    
         
            +
                      #   #=> [Mail.new(name: 'a@a.com'), Mail.new(name: 'b@b.com')]
         
     | 
| 
      
 17 
     | 
    
         
            +
                      unless method_defined?("#{field}_with_arraymap=")
         
     | 
| 
      
 18 
     | 
    
         
            +
                        define_method("#{field}_with_arraymap=") do |raw_array|
         
     | 
| 
      
 19 
     | 
    
         
            +
                          obj_array = __send__("make_#{field}", raw_array)
         
     | 
| 
      
 20 
     | 
    
         
            +
                          __send__("#{field}_without_arraymap=", obj_array)
         
     | 
| 
      
 21 
     | 
    
         
            +
                        end
         
     | 
| 
      
 22 
     | 
    
         
            +
                        define_method("#{field}=") {|*args| } unless method_defined?("#{field}=")
         
     | 
| 
      
 23 
     | 
    
         
            +
                        alias_method("#{field}_without_arraymap=", "#{field}=")
         
     | 
| 
      
 24 
     | 
    
         
            +
                        alias_method("#{field}=", "#{field}_with_arraymap=")
         
     | 
| 
      
 25 
     | 
    
         
            +
                      end
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
                      # Example:
         
     | 
| 
      
 28 
     | 
    
         
            +
                      #
         
     | 
| 
      
 29 
     | 
    
         
            +
                      # mails_without_arraymap #=> [Mail.new(name: 'a@a.com'), Mail.new(name: 'b@b.com')]
         
     | 
| 
      
 30 
     | 
    
         
            +
                      # mails | mails_with_arraymap #=> ['a@a.com', 'b@b.com']
         
     | 
| 
      
 31 
     | 
    
         
            +
                      unless method_defined?("#{field}_with_arraymap")
         
     | 
| 
      
 32 
     | 
    
         
            +
                        define_method("#{field}_with_arraymap") do
         
     | 
| 
      
 33 
     | 
    
         
            +
                          obj_array = __send__("#{field}_without_arraymap")
         
     | 
| 
      
 34 
     | 
    
         
            +
                          obj_array.map {|obj| obj.__send__(opts[:field]) }
         
     | 
| 
      
 35 
     | 
    
         
            +
                        end
         
     | 
| 
      
 36 
     | 
    
         
            +
                        define_method("#{field}") { } unless method_defined?("#{field}")
         
     | 
| 
      
 37 
     | 
    
         
            +
                        alias_method("#{field}_without_arraymap", "#{field}")
         
     | 
| 
      
 38 
     | 
    
         
            +
                        alias_method("#{field}", "#{field}_with_arraymap")
         
     | 
| 
      
 39 
     | 
    
         
            +
                      end
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
                      # obj_mails #=> [Mail.new(name: 'a@a.com'), Mail.new(name: 'b@b.com')]
         
     | 
| 
      
 42 
     | 
    
         
            +
                      define_method("obj_#{field}") do
         
     | 
| 
      
 43 
     | 
    
         
            +
                        __send__("#{field}_without_arraymap")
         
     | 
| 
      
 44 
     | 
    
         
            +
                      end
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
                      # make_xxxx(raw_array) #=> obj_array
         
     | 
| 
      
 47 
     | 
    
         
            +
                      #
         
     | 
| 
      
 48 
     | 
    
         
            +
                      # Example:
         
     | 
| 
      
 49 
     | 
    
         
            +
                      #
         
     | 
| 
      
 50 
     | 
    
         
            +
                      # make_mails(['a@a.com', 'b@b.com'])
         
     | 
| 
      
 51 
     | 
    
         
            +
                      #   #=> [Mail.new(name: 'a@a.com'), Mail.new(name: 'b@b.com')]
         
     | 
| 
      
 52 
     | 
    
         
            +
                      define_method("make_#{field}") do |raw_array|
         
     | 
| 
      
 53 
     | 
    
         
            +
                        return nil unless raw_array
         
     | 
| 
      
 54 
     | 
    
         
            +
                        raw_array.map {|val| opts[:class].find_or_initialize_by(opts[:field] => val) }
         
     | 
| 
      
 55 
     | 
    
         
            +
                      end
         
     | 
| 
      
 56 
     | 
    
         
            +
                    end
         
     | 
| 
      
 57 
     | 
    
         
            +
                  end
         
     | 
| 
      
 58 
     | 
    
         
            +
                end
         
     | 
| 
      
 59 
     | 
    
         
            +
              end
         
     | 
| 
      
 60 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,75 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require_relative 'spec_helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require_relative 'model'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            describe ActsAsArray do
         
     | 
| 
      
 5 
     | 
    
         
            +
              after do
         
     | 
| 
      
 6 
     | 
    
         
            +
                User.delete_all
         
     | 
| 
      
 7 
     | 
    
         
            +
                Mail.delete_all
         
     | 
| 
      
 8 
     | 
    
         
            +
                Phone.delete_all
         
     | 
| 
      
 9 
     | 
    
         
            +
              end
         
     | 
| 
      
 10 
     | 
    
         
            +
              let(:user) { User.new(name: 'test') }
         
     | 
| 
      
 11 
     | 
    
         
            +
              let(:raw_mails) { ['a@a.com', 'b@b.com'] }
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
              context '#make_fields' do
         
     | 
| 
      
 14 
     | 
    
         
            +
                let(:subject) { user.make_mails(raw_mails) }
         
     | 
| 
      
 15 
     | 
    
         
            +
                it 'should convert raw fields to obj fields' do
         
     | 
| 
      
 16 
     | 
    
         
            +
                  expect(subject.map(&:name)).to eql(raw_mails)
         
     | 
| 
      
 17 
     | 
    
         
            +
                  expect(Mail.all.size).to eql(0)
         
     | 
| 
      
 18 
     | 
    
         
            +
                end
         
     | 
| 
      
 19 
     | 
    
         
            +
              end
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
              context '#fields=' do
         
     | 
| 
      
 22 
     | 
    
         
            +
                before { user.mails = raw_mails }
         
     | 
| 
      
 23 
     | 
    
         
            +
                it 'should set raw fields as obj fields' do
         
     | 
| 
      
 24 
     | 
    
         
            +
                  expect(user.obj_mails.map(&:name)).to eql(raw_mails)
         
     | 
| 
      
 25 
     | 
    
         
            +
                  expect(Mail.all.size).to eql(0)
         
     | 
| 
      
 26 
     | 
    
         
            +
                end
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
                it 'should create objects with #save' do
         
     | 
| 
      
 29 
     | 
    
         
            +
                  user.save
         
     | 
| 
      
 30 
     | 
    
         
            +
                  expect(Mail.all.size).to eql(2)
         
     | 
| 
      
 31 
     | 
    
         
            +
                end
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
                it 'should not create already existing objects' do
         
     | 
| 
      
 34 
     | 
    
         
            +
                  user.save
         
     | 
| 
      
 35 
     | 
    
         
            +
                  user.mails = raw_mails
         
     | 
| 
      
 36 
     | 
    
         
            +
                  expect(Mail.all.size).to eql(2)
         
     | 
| 
      
 37 
     | 
    
         
            +
                end
         
     | 
| 
      
 38 
     | 
    
         
            +
              end
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
              context '#fields' do
         
     | 
| 
      
 41 
     | 
    
         
            +
                before { user.mails = raw_mails }
         
     | 
| 
      
 42 
     | 
    
         
            +
                it 'should return raw fields' do
         
     | 
| 
      
 43 
     | 
    
         
            +
                  expect(user.mails).to eql(raw_mails)
         
     | 
| 
      
 44 
     | 
    
         
            +
                end
         
     | 
| 
      
 45 
     | 
    
         
            +
              end
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
              context '#obj_fields' do
         
     | 
| 
      
 48 
     | 
    
         
            +
                before { user.mails = raw_mails }
         
     | 
| 
      
 49 
     | 
    
         
            +
                it 'should return obj fields' do
         
     | 
| 
      
 50 
     | 
    
         
            +
                  expect(user.obj_mails.map(&:name)).to eql(raw_mails)
         
     | 
| 
      
 51 
     | 
    
         
            +
                end
         
     | 
| 
      
 52 
     | 
    
         
            +
              end
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
              context '#update_attributes' do
         
     | 
| 
      
 55 
     | 
    
         
            +
                it 'should update_attributes with raw fields' do
         
     | 
| 
      
 56 
     | 
    
         
            +
                  user.update_attributes(mails: raw_mails)
         
     | 
| 
      
 57 
     | 
    
         
            +
                  expect(user.obj_mails.map(&:name)).to eql(raw_mails)
         
     | 
| 
      
 58 
     | 
    
         
            +
                  expect(Mail.all.size).to eql(2)
         
     | 
| 
      
 59 
     | 
    
         
            +
                end
         
     | 
| 
      
 60 
     | 
    
         
            +
              end
         
     | 
| 
      
 61 
     | 
    
         
            +
             
     | 
| 
      
 62 
     | 
    
         
            +
              context '#update' do
         
     | 
| 
      
 63 
     | 
    
         
            +
                it 'should update with raw fields' do
         
     | 
| 
      
 64 
     | 
    
         
            +
                  user.update(mails: raw_mails)
         
     | 
| 
      
 65 
     | 
    
         
            +
                  expect(user.obj_mails.map(&:name)).to eql(raw_mails)
         
     | 
| 
      
 66 
     | 
    
         
            +
                  expect(Mail.all.size).to eql(2)
         
     | 
| 
      
 67 
     | 
    
         
            +
                end
         
     | 
| 
      
 68 
     | 
    
         
            +
              end
         
     | 
| 
      
 69 
     | 
    
         
            +
             
     | 
| 
      
 70 
     | 
    
         
            +
              context '.create' do
         
     | 
| 
      
 71 
     | 
    
         
            +
                let(:user) { User.create(name: 'test', mails: raw_mails) }
         
     | 
| 
      
 72 
     | 
    
         
            +
                it { expect(user.obj_mails.map(&:name)).to eql(raw_mails) }
         
     | 
| 
      
 73 
     | 
    
         
            +
              end
         
     | 
| 
      
 74 
     | 
    
         
            +
            end
         
     | 
| 
      
 75 
     | 
    
         
            +
             
     | 
| 
         @@ -0,0 +1,43 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'active_record'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'logger'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
         
     | 
| 
      
 4 
     | 
    
         
            +
            namespace :db do
         
     | 
| 
      
 5 
     | 
    
         
            +
              MIGRATIONS_DIR = 'db/migrate'
         
     | 
| 
      
 6 
     | 
    
         
            +
              SCHEMA_FILE    = 'db/schema.rb'
         
     | 
| 
      
 7 
     | 
    
         
            +
              DB_FILE        = 'db/sqlite.db'
         
     | 
| 
      
 8 
     | 
    
         
            +
             
         
     | 
| 
      
 9 
     | 
    
         
            +
              # connect the database
         
     | 
| 
      
 10 
     | 
    
         
            +
              ActiveRecord::Base.establish_connection(
         
     | 
| 
      
 11 
     | 
    
         
            +
                :adapter => 'sqlite3',
         
     | 
| 
      
 12 
     | 
    
         
            +
                :database => DB_FILE
         
     | 
| 
      
 13 
     | 
    
         
            +
              )
         
     | 
| 
      
 14 
     | 
    
         
            +
             
         
     | 
| 
      
 15 
     | 
    
         
            +
              # outpt logs
         
     | 
| 
      
 16 
     | 
    
         
            +
              # ActiveRecord::Base.logger = Logger.new(STDOUT)
         
     | 
| 
      
 17 
     | 
    
         
            +
             
         
     | 
| 
      
 18 
     | 
    
         
            +
              desc "Migrate the database"
         
     | 
| 
      
 19 
     | 
    
         
            +
              task :migrate do
         
     | 
| 
      
 20 
     | 
    
         
            +
                ActiveRecord::Migrator.migrate(MIGRATIONS_DIR, ENV["VERSION"] ? ENV["VERSION"].to_i : nil)
         
     | 
| 
      
 21 
     | 
    
         
            +
              end
         
     | 
| 
      
 22 
     | 
    
         
            +
             
         
     | 
| 
      
 23 
     | 
    
         
            +
              desc 'Roll back the database schema to the previous version'
         
     | 
| 
      
 24 
     | 
    
         
            +
              task :rollback do
         
     | 
| 
      
 25 
     | 
    
         
            +
                ActiveRecord::Migrator.rollback(MIGRATIONS_DIR, ENV['STEP'] ? ENV['STEP'].to_i : 1)
         
     | 
| 
      
 26 
     | 
    
         
            +
              end
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
              namespace :schema do
         
     | 
| 
      
 29 
     | 
    
         
            +
                desc "Create a db/schema.rb file that can be portably used against any DB supported by AR"
         
     | 
| 
      
 30 
     | 
    
         
            +
                task :dump do
         
     | 
| 
      
 31 
     | 
    
         
            +
                  require 'active_record/schema_dumper'
         
     | 
| 
      
 32 
     | 
    
         
            +
                  File.open(ENV['SCHEMA'] || SCHEMA_FILE, "w") do |file|
         
     | 
| 
      
 33 
     | 
    
         
            +
                    ActiveRecord::SchemaDumper.dump(ActiveRecord::Base.connection, file)
         
     | 
| 
      
 34 
     | 
    
         
            +
                  end
         
     | 
| 
      
 35 
     | 
    
         
            +
                end
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                desc "Load a schema.rb file into the database"
         
     | 
| 
      
 38 
     | 
    
         
            +
                task :load do
         
     | 
| 
      
 39 
     | 
    
         
            +
                  file = ENV['SCHEMA'] || SCHEMA_FILE
         
     | 
| 
      
 40 
     | 
    
         
            +
                  load(file)
         
     | 
| 
      
 41 
     | 
    
         
            +
                end
         
     | 
| 
      
 42 
     | 
    
         
            +
              end
         
     | 
| 
      
 43 
     | 
    
         
            +
            end
         
     | 
    
        data/spec/model.rb
    ADDED
    
    | 
         @@ -0,0 +1,30 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'active_record'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'acts_as_array'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            # create_table :users do |t|
         
     | 
| 
      
 5 
     | 
    
         
            +
            #   t.string :name
         
     | 
| 
      
 6 
     | 
    
         
            +
            # end
         
     | 
| 
      
 7 
     | 
    
         
            +
            # create_table :mails do |t|
         
     | 
| 
      
 8 
     | 
    
         
            +
            #   t.string :name
         
     | 
| 
      
 9 
     | 
    
         
            +
            #   t.references :user
         
     | 
| 
      
 10 
     | 
    
         
            +
            # end
         
     | 
| 
      
 11 
     | 
    
         
            +
            # create_table :phones do |t|
         
     | 
| 
      
 12 
     | 
    
         
            +
            #   t.string :name
         
     | 
| 
      
 13 
     | 
    
         
            +
            #   t.references :user
         
     | 
| 
      
 14 
     | 
    
         
            +
            # end
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            class Mail < ActiveRecord::Base
         
     | 
| 
      
 17 
     | 
    
         
            +
              belongs_to :user
         
     | 
| 
      
 18 
     | 
    
         
            +
            end
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            class Phone < ActiveRecord::Base
         
     | 
| 
      
 21 
     | 
    
         
            +
              belongs_to :user
         
     | 
| 
      
 22 
     | 
    
         
            +
            end
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
            class User < ActiveRecord::Base
         
     | 
| 
      
 25 
     | 
    
         
            +
              include ActsAsArray
         
     | 
| 
      
 26 
     | 
    
         
            +
              has_many :mails
         
     | 
| 
      
 27 
     | 
    
         
            +
              has_many :phones
         
     | 
| 
      
 28 
     | 
    
         
            +
              acts_as_array :mails => {:class => Mail, :field => :name},
         
     | 
| 
      
 29 
     | 
    
         
            +
                :phones => {:class => Phone, :field => :name}
         
     | 
| 
      
 30 
     | 
    
         
            +
            end
         
     | 
    
        data/spec/spec_helper.rb
    ADDED
    
    | 
         @@ -0,0 +1,19 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'rubygems'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'rspec'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'pry'
         
     | 
| 
      
 4 
     | 
    
         
            +
            $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../lib')
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            require 'active_record'
         
     | 
| 
      
 7 
     | 
    
         
            +
            ActiveRecord::Base.establish_connection(
         
     | 
| 
      
 8 
     | 
    
         
            +
              :adapter => 'sqlite3',
         
     | 
| 
      
 9 
     | 
    
         
            +
              :database => 'db/sqlite.db'
         
     | 
| 
      
 10 
     | 
    
         
            +
            )
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            #require 'rake'
         
     | 
| 
      
 13 
     | 
    
         
            +
            #require_relative 'migrate_tasks'
         
     | 
| 
      
 14 
     | 
    
         
            +
            #Rake::Task['db:schema:load'].invoke
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            if ENV['TRAVIS']
         
     | 
| 
      
 17 
     | 
    
         
            +
              require 'coveralls'
         
     | 
| 
      
 18 
     | 
    
         
            +
              Coveralls.wear!
         
     | 
| 
      
 19 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    ADDED
    
    | 
         @@ -0,0 +1,121 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification
         
     | 
| 
      
 2 
     | 
    
         
            +
            name: acts_as_array
         
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.0.1
         
     | 
| 
      
 5 
     | 
    
         
            +
            platform: ruby
         
     | 
| 
      
 6 
     | 
    
         
            +
            authors:
         
     | 
| 
      
 7 
     | 
    
         
            +
            - Naotoshi Seo
         
     | 
| 
      
 8 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
      
 9 
     | 
    
         
            +
            bindir: bin
         
     | 
| 
      
 10 
     | 
    
         
            +
            cert_chain: []
         
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2014-06-04 00:00:00.000000000 Z
         
     | 
| 
      
 12 
     | 
    
         
            +
            dependencies:
         
     | 
| 
      
 13 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 14 
     | 
    
         
            +
              name: rspec
         
     | 
| 
      
 15 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 16 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 17 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 18 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 19 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 20 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 21 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 22 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 23 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 24 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 25 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 26 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 27 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 28 
     | 
    
         
            +
              name: rake
         
     | 
| 
      
 29 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 30 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 31 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 32 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 33 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 34 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 35 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 36 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 37 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 38 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 39 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 40 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 41 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 42 
     | 
    
         
            +
              name: pry
         
     | 
| 
      
 43 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 44 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 45 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 46 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 47 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 48 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 49 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 50 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 51 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 52 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 53 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 54 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 55 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 56 
     | 
    
         
            +
              name: pry-nav
         
     | 
| 
      
 57 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 58 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 59 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 60 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 61 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 62 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 63 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 64 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 65 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 66 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 67 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 68 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 69 
     | 
    
         
            +
            description: Treat array fields simply.
         
     | 
| 
      
 70 
     | 
    
         
            +
            email:
         
     | 
| 
      
 71 
     | 
    
         
            +
            - sonots@gmail.com
         
     | 
| 
      
 72 
     | 
    
         
            +
            executables: []
         
     | 
| 
      
 73 
     | 
    
         
            +
            extensions: []
         
     | 
| 
      
 74 
     | 
    
         
            +
            extra_rdoc_files: []
         
     | 
| 
      
 75 
     | 
    
         
            +
            files:
         
     | 
| 
      
 76 
     | 
    
         
            +
            - ".gitignore"
         
     | 
| 
      
 77 
     | 
    
         
            +
            - ".travis.yml"
         
     | 
| 
      
 78 
     | 
    
         
            +
            - CHANGELOG.md
         
     | 
| 
      
 79 
     | 
    
         
            +
            - Gemfile
         
     | 
| 
      
 80 
     | 
    
         
            +
            - LICENSE
         
     | 
| 
      
 81 
     | 
    
         
            +
            - README.md
         
     | 
| 
      
 82 
     | 
    
         
            +
            - Rakefile
         
     | 
| 
      
 83 
     | 
    
         
            +
            - acts_as_array.gemspec
         
     | 
| 
      
 84 
     | 
    
         
            +
            - db/migrate/001_create_users.rb
         
     | 
| 
      
 85 
     | 
    
         
            +
            - db/migrate/002_create_mails.rb
         
     | 
| 
      
 86 
     | 
    
         
            +
            - db/migrate/003_create_phones.rb
         
     | 
| 
      
 87 
     | 
    
         
            +
            - db/schema.rb
         
     | 
| 
      
 88 
     | 
    
         
            +
            - lib/acts_as_array.rb
         
     | 
| 
      
 89 
     | 
    
         
            +
            - spec/acts_as_array_spec.rb
         
     | 
| 
      
 90 
     | 
    
         
            +
            - spec/migrate_tasks.rb
         
     | 
| 
      
 91 
     | 
    
         
            +
            - spec/model.rb
         
     | 
| 
      
 92 
     | 
    
         
            +
            - spec/spec_helper.rb
         
     | 
| 
      
 93 
     | 
    
         
            +
            homepage: https://github.com/sonots/acts_as_array
         
     | 
| 
      
 94 
     | 
    
         
            +
            licenses: []
         
     | 
| 
      
 95 
     | 
    
         
            +
            metadata: {}
         
     | 
| 
      
 96 
     | 
    
         
            +
            post_install_message: 
         
     | 
| 
      
 97 
     | 
    
         
            +
            rdoc_options:
         
     | 
| 
      
 98 
     | 
    
         
            +
            - "--charset=UTF-8"
         
     | 
| 
      
 99 
     | 
    
         
            +
            require_paths:
         
     | 
| 
      
 100 
     | 
    
         
            +
            - lib
         
     | 
| 
      
 101 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 102 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 103 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 104 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 105 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 106 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 107 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 108 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 109 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 110 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 111 
     | 
    
         
            +
            requirements: []
         
     | 
| 
      
 112 
     | 
    
         
            +
            rubyforge_project: 
         
     | 
| 
      
 113 
     | 
    
         
            +
            rubygems_version: 2.2.2
         
     | 
| 
      
 114 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
      
 115 
     | 
    
         
            +
            specification_version: 4
         
     | 
| 
      
 116 
     | 
    
         
            +
            summary: Treat array fields simply
         
     | 
| 
      
 117 
     | 
    
         
            +
            test_files:
         
     | 
| 
      
 118 
     | 
    
         
            +
            - spec/acts_as_array_spec.rb
         
     | 
| 
      
 119 
     | 
    
         
            +
            - spec/migrate_tasks.rb
         
     | 
| 
      
 120 
     | 
    
         
            +
            - spec/model.rb
         
     | 
| 
      
 121 
     | 
    
         
            +
            - spec/spec_helper.rb
         
     |