JSONRecord 0.0.10
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 +17 -0
 - data/Gemfile +4 -0
 - data/JSONRecord.gemspec +22 -0
 - data/LICENSE.txt +22 -0
 - data/README.md +73 -0
 - data/Rakefile +11 -0
 - data/bin/jsonrecord +14 -0
 - data/lib/JSONRecord/active_model_inclusions.rb +7 -0
 - data/lib/JSONRecord/class_methods.rb +109 -0
 - data/lib/JSONRecord/errors.rb +16 -0
 - data/lib/JSONRecord/instance_methods.rb +100 -0
 - data/lib/JSONRecord/json_hash.rb +9 -0
 - data/lib/JSONRecord/json_schema.rb +12 -0
 - data/lib/JSONRecord/meth_missing.rb +34 -0
 - data/lib/JSONRecord/module_methods.rb +10 -0
 - data/lib/JSONRecord/relation.rb +41 -0
 - data/lib/JSONRecord/version.rb +3 -0
 - data/lib/JSONRecord.rb +13 -0
 - data/lib/loader.rb +15 -0
 - data/lib/tables/.DS_Store +0 -0
 - data/test/lib/jsonrecord/version_test.rb +8 -0
 - data/test/test_helper.rb +6 -0
 - metadata +111 -0
 
    
        checksums.yaml
    ADDED
    
    | 
         @@ -0,0 +1,7 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ---
         
     | 
| 
      
 2 
     | 
    
         
            +
            SHA1:
         
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 5f37ce63a5a610a84186967c0ec555d48bc7a52d
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 9b10ee7d369c578e2a5a7b05af4a98840c407ee3
         
     | 
| 
      
 5 
     | 
    
         
            +
            SHA512:
         
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: eeaa141d06cb9c5f60a7dba78501b770d00efcbee44bdccac63ddfa2a5bcfd63a7cd160fe374f0bc50ff14fae0631342eff1a8ab71fa024dbca71edc868bdfd5
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: a291d9fbae5ad8484af9f2d7e822e8ae9f18f8d5d2999d2fbda18cb5f8668d82b6c313010798eb31dd863ed649c5b5a193760409cc6198acefbe94219b0a7cdf
         
     | 
    
        data/.gitignore
    ADDED
    
    
    
        data/Gemfile
    ADDED
    
    
    
        data/JSONRecord.gemspec
    ADDED
    
    | 
         @@ -0,0 +1,22 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # -*- encoding: utf-8 -*-
         
     | 
| 
      
 2 
     | 
    
         
            +
            lib = File.expand_path('../lib', __FILE__)
         
     | 
| 
      
 3 
     | 
    
         
            +
            $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'JSONRecord/version'
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            Gem::Specification.new do |gem|
         
     | 
| 
      
 7 
     | 
    
         
            +
              gem.name          = "JSONRecord"
         
     | 
| 
      
 8 
     | 
    
         
            +
              gem.version       = JSONRecord::VERSION
         
     | 
| 
      
 9 
     | 
    
         
            +
              gem.authors       = ["Pankaj Doharey"]
         
     | 
| 
      
 10 
     | 
    
         
            +
              gem.email         = ["pankajdoharey@gmail.com"]
         
     | 
| 
      
 11 
     | 
    
         
            +
              gem.description   = %q{JSON Data storage in ruby}
         
     | 
| 
      
 12 
     | 
    
         
            +
              gem.summary       = %q{JSONRecord is a minimal document storage for rails, with an active record style query interface.}
         
     | 
| 
      
 13 
     | 
    
         
            +
              gem.homepage      = "http://jsondb.codemismatch.com"
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
              gem.files         = `git ls-files`.split($/)
         
     | 
| 
      
 16 
     | 
    
         
            +
              gem.executables   = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
         
     | 
| 
      
 17 
     | 
    
         
            +
              gem.test_files    = gem.files.grep(%r{^(test|spec|features)/})
         
     | 
| 
      
 18 
     | 
    
         
            +
              gem.require_paths = ["lib"]
         
     | 
| 
      
 19 
     | 
    
         
            +
              gem.add_dependency "activesupport", "~> 3.2.8"
         
     | 
| 
      
 20 
     | 
    
         
            +
              gem.add_dependency "activemodel", "~> 3.2.8"
         
     | 
| 
      
 21 
     | 
    
         
            +
              gem.add_dependency "yajl-ruby", "~> 1.1.0"
         
     | 
| 
      
 22 
     | 
    
         
            +
            end
         
     | 
    
        data/LICENSE.txt
    ADDED
    
    | 
         @@ -0,0 +1,22 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            Copyright (c) 2013 Pankaj Doharey
         
     | 
| 
      
 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,73 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # JSONRecord
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            JSONRecord is a minimal document storage for rails, with an active record style query interface.
         
     | 
| 
      
 4 
     | 
    
         
            +
            It eventually aims to be as powerfull of other document stores like couchdb ... this is just a beginning.
         
     | 
| 
      
 5 
     | 
    
         
            +
            Inventual Roadmap is to make it independent of rails.
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            ## Installation
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            Add this line to your application's Gemfile:
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                gem 'JSONRecord'
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
            And then execute:
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                $ bundle
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            Or install it yourself as:
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            $ gem install JSONRecord
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
            ## Usage
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
            TODO: It is very easy to use jsondb as a document store in rails, create a model in rails/model and inherit from JSONRecord::Base
         
     | 
| 
      
 25 
     | 
    
         
            +
            			it gives few mechanisms to search and save data in json files.
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
            			In order to generate new models a binary file is included: 
         
     | 
| 
      
 28 
     | 
    
         
            +
            			
         
     | 
| 
      
 29 
     | 
    
         
            +
            			`jsonrecord generate model apple` (make sure your model name is singular)
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
            			then in model/apple.rb
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
            			class Apple < JSONRecord::Base
         
     | 
| 
      
 34 
     | 
    
         
            +
            									
         
     | 
| 
      
 35 
     | 
    
         
            +
            			  def index
         
     | 
| 
      
 36 
     | 
    
         
            +
            		 	  end
         
     | 
| 
      
 37 
     | 
    
         
            +
            			
         
     | 
| 
      
 38 
     | 
    
         
            +
            			end
         
     | 
| 
      
 39 
     | 
    
         
            +
            			
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
            			
         
     | 
| 
      
 42 
     | 
    
         
            +
            ##Methods include :
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
            find(id) , find_by_column_name("column_value"), model_instance.update_attributes(:name => "pankaj" , :age => "29")
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
            also ,
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
            Model.new({:name=> "pankaj" , :age => "29"}).save
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
            In your rails model: In order to define new attributes use `column` method
         
     | 
| 
      
 52 
     | 
    
         
            +
            i.e  column :column_name , datetype
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
            example => column :name
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
            by default if the second parameter is not defined it is taken as a string other wise datatypes can be defined as follows
         
     | 
| 
      
 58 
     | 
    
         
            +
             
     | 
| 
      
 59 
     | 
    
         
            +
            column :name, String
         
     | 
| 
      
 60 
     | 
    
         
            +
            column :age, Number
         
     | 
| 
      
 61 
     | 
    
         
            +
            column :marks, Array
         
     | 
| 
      
 62 
     | 
    
         
            +
             
     | 
| 
      
 63 
     | 
    
         
            +
            Currently JSONRecord supports three datatypes String , Number , Array , More are coming ... As soon as code is modified to use
         
     | 
| 
      
 64 
     | 
    
         
            +
            messagepack or BSON.
         
     | 
| 
      
 65 
     | 
    
         
            +
            				 
         
     | 
| 
      
 66 
     | 
    
         
            +
             
     | 
| 
      
 67 
     | 
    
         
            +
            ## Contributing
         
     | 
| 
      
 68 
     | 
    
         
            +
             
     | 
| 
      
 69 
     | 
    
         
            +
            1. Fork it
         
     | 
| 
      
 70 
     | 
    
         
            +
            2. Create your feature branch (`git checkout -b my-new-feature`)
         
     | 
| 
      
 71 
     | 
    
         
            +
            3. Commit your changes (`git commit -am 'Add some feature'`)
         
     | 
| 
      
 72 
     | 
    
         
            +
            4. Push to the branch (`git push origin my-new-feature`)
         
     | 
| 
      
 73 
     | 
    
         
            +
            5. Create new Pull Request
         
     | 
    
        data/Rakefile
    ADDED
    
    
    
        data/bin/jsonrecord
    ADDED
    
    | 
         @@ -0,0 +1,14 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #!/usr/bin/env ruby
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require 'optparse'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'active_support'
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            tables_dir = File.expand_path('../../lib/tables',__FILE__)
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            include ActiveSupport::Inflector
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            if ARGV[0] == 'generate' and ARGV[1] == 'model'
         
     | 
| 
      
 11 
     | 
    
         
            +
              model_name = Inflections.pluralize(ARGV[2])
         
     | 
| 
      
 12 
     | 
    
         
            +
              FileUtils.touch "#{tables_dir}/#{model_name}.json"
         
     | 
| 
      
 13 
     | 
    
         
            +
              puts "JSONRecord table created : #{tables_dir}/#{model_name}.json"
         
     | 
| 
      
 14 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,109 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module JSONRecord
         
     | 
| 
      
 2 
     | 
    
         
            +
              def inspect
         
     | 
| 
      
 3 
     | 
    
         
            +
                if path_finder
         
     | 
| 
      
 4 
     | 
    
         
            +
                  self.is_a?(Class) ? "#{self.to_s}(#{columns})" : "#{self.to_s}"
         
     | 
| 
      
 5 
     | 
    
         
            +
                else
         
     | 
| 
      
 6 
     | 
    
         
            +
                  self.parent_name.eql?("JSONRecord") ? self.to_s : "#{self.to_s}(JSON Table not Found!)"
         
     | 
| 
      
 7 
     | 
    
         
            +
                end
         
     | 
| 
      
 8 
     | 
    
         
            +
              end
         
     | 
| 
      
 9 
     | 
    
         
            +
              
         
     | 
| 
      
 10 
     | 
    
         
            +
              def table_name
         
     | 
| 
      
 11 
     | 
    
         
            +
                if self.is_a? Class
         
     | 
| 
      
 12 
     | 
    
         
            +
                  raise AttributeError if self.parents.include? JSONRecord
         
     | 
| 
      
 13 
     | 
    
         
            +
                  self.to_s.pluralize.downcase
         
     | 
| 
      
 14 
     | 
    
         
            +
                else
         
     | 
| 
      
 15 
     | 
    
         
            +
                  self.class.to_s.pluralize.downcase
         
     | 
| 
      
 16 
     | 
    
         
            +
                end
         
     | 
| 
      
 17 
     | 
    
         
            +
              end
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
              def scoped
         
     | 
| 
      
 20 
     | 
    
         
            +
                self.class
         
     | 
| 
      
 21 
     | 
    
         
            +
              end
         
     | 
| 
      
 22 
     | 
    
         
            +
              
         
     | 
| 
      
 23 
     | 
    
         
            +
              #Scoped and unscoped alias method for active record compatibility
         
     | 
| 
      
 24 
     | 
    
         
            +
              alias_method :unscoped , :scoped
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
              def connection
         
     | 
| 
      
 27 
     | 
    
         
            +
                self.class
         
     | 
| 
      
 28 
     | 
    
         
            +
              end
         
     | 
| 
      
 29 
     | 
    
         
            +
              
         
     | 
| 
      
 30 
     | 
    
         
            +
              def find(id)
         
     | 
| 
      
 31 
     | 
    
         
            +
                record = find_record(id.to_i)
         
     | 
| 
      
 32 
     | 
    
         
            +
                if record.nil? or record.empty?
         
     | 
| 
      
 33 
     | 
    
         
            +
                  raise RecordNotFound,"Record Not Found for #{self}" rescue "#{$!.class}::#{$!.message}"
         
     | 
| 
      
 34 
     | 
    
         
            +
                else
         
     | 
| 
      
 35 
     | 
    
         
            +
                  record
         
     | 
| 
      
 36 
     | 
    
         
            +
                end
         
     | 
| 
      
 37 
     | 
    
         
            +
              end
         
     | 
| 
      
 38 
     | 
    
         
            +
                
         
     | 
| 
      
 39 
     | 
    
         
            +
              def first(numb=nil)
         
     | 
| 
      
 40 
     | 
    
         
            +
                get_terminal_record(:first, numb) unless json_data.empty?
         
     | 
| 
      
 41 
     | 
    
         
            +
              end
         
     | 
| 
      
 42 
     | 
    
         
            +
              
         
     | 
| 
      
 43 
     | 
    
         
            +
              def last(numb=nil)
         
     | 
| 
      
 44 
     | 
    
         
            +
                get_terminal_record(:last, numb) unless json_data.empty?
         
     | 
| 
      
 45 
     | 
    
         
            +
              end
         
     | 
| 
      
 46 
     | 
    
         
            +
              
         
     | 
| 
      
 47 
     | 
    
         
            +
              def all
         
     | 
| 
      
 48 
     | 
    
         
            +
                json_data.map{|datum| send(:new , datum)}
         
     | 
| 
      
 49 
     | 
    
         
            +
              end
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
              def columns
         
     | 
| 
      
 52 
     | 
    
         
            +
                Hash[COLUMN_ATTRIBUTES[table_name].map{|i| [i.first,i.last.to_s]}].to_s.gsub("=>",":").gsub(/\"/,"")
         
     | 
| 
      
 53 
     | 
    
         
            +
              end
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
              def column_names
         
     | 
| 
      
 56 
     | 
    
         
            +
                COLUMN_ATTRIBUTES[table_name].map{|key| key.first }
         
     | 
| 
      
 57 
     | 
    
         
            +
              end
         
     | 
| 
      
 58 
     | 
    
         
            +
              
         
     | 
| 
      
 59 
     | 
    
         
            +
              private
         
     | 
| 
      
 60 
     | 
    
         
            +
              Dir.glob File.expand_path("../../tables/**/*.json", __FILE__) do |file|
         
     | 
| 
      
 61 
     | 
    
         
            +
                JSON_TABLES[File.basename(file)] = file
         
     | 
| 
      
 62 
     | 
    
         
            +
              end
         
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
| 
      
 64 
     | 
    
         
            +
              #Populate column_attrubtes hash with table_names with no fields
         
     | 
| 
      
 65 
     | 
    
         
            +
              JSON_TABLES.keys.each do |file_name|
         
     | 
| 
      
 66 
     | 
    
         
            +
                COLUMN_ATTRIBUTES[File.basename(file_name,".json")] = [["id",Integer]]
         
     | 
| 
      
 67 
     | 
    
         
            +
              end
         
     | 
| 
      
 68 
     | 
    
         
            +
             
     | 
| 
      
 69 
     | 
    
         
            +
              def json_data
         
     | 
| 
      
 70 
     | 
    
         
            +
                JSON.parse(File.read(path_finder))
         
     | 
| 
      
 71 
     | 
    
         
            +
              end
         
     | 
| 
      
 72 
     | 
    
         
            +
              
         
     | 
| 
      
 73 
     | 
    
         
            +
              def path_finder
         
     | 
| 
      
 74 
     | 
    
         
            +
                JSON_TABLES["#{table_name}.json"]
         
     | 
| 
      
 75 
     | 
    
         
            +
              end
         
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
      
 77 
     | 
    
         
            +
              def initialize_columns
         
     | 
| 
      
 78 
     | 
    
         
            +
                column_names.each{|column| self[column] = nil }
         
     | 
| 
      
 79 
     | 
    
         
            +
              end
         
     | 
| 
      
 80 
     | 
    
         
            +
             
     | 
| 
      
 81 
     | 
    
         
            +
              def find_record(id)
         
     | 
| 
      
 82 
     | 
    
         
            +
                if id.is_a?(Array) or id.is_a?(Range)
         
     | 
| 
      
 83 
     | 
    
         
            +
                  if id.is_a?(Range)
         
     | 
| 
      
 84 
     | 
    
         
            +
                    elem = id.step
         
     | 
| 
      
 85 
     | 
    
         
            +
                  elsif id.first.is_a?(Range)
         
     | 
| 
      
 86 
     | 
    
         
            +
                    elem = id.first.step
         
     | 
| 
      
 87 
     | 
    
         
            +
                  else
         
     | 
| 
      
 88 
     | 
    
         
            +
                    elem = id.flatten
         
     | 
| 
      
 89 
     | 
    
         
            +
                  end
         
     | 
| 
      
 90 
     | 
    
         
            +
                  all.select{|i| i if elem.include? i["id"] }
         
     | 
| 
      
 91 
     | 
    
         
            +
                elsif id.is_a? Fixnum
         
     | 
| 
      
 92 
     | 
    
         
            +
                  all.select{|i| i if i["id"] == id }.first
         
     | 
| 
      
 93 
     | 
    
         
            +
                end
         
     | 
| 
      
 94 
     | 
    
         
            +
              end
         
     | 
| 
      
 95 
     | 
    
         
            +
             
     | 
| 
      
 96 
     | 
    
         
            +
              def get_terminal_record(sym, numb)
         
     | 
| 
      
 97 
     | 
    
         
            +
                if numb.nil?
         
     | 
| 
      
 98 
     | 
    
         
            +
                  send(:new, json_data.send(sym))
         
     | 
| 
      
 99 
     | 
    
         
            +
                else
         
     | 
| 
      
 100 
     | 
    
         
            +
                  begin
         
     | 
| 
      
 101 
     | 
    
         
            +
                    raise TypeError,"can't convert #{numb.class}, Expected an Integer" unless numb.is_a?(Fixnum)
         
     | 
| 
      
 102 
     | 
    
         
            +
                    records = json_data.send(sym , numb)
         
     | 
| 
      
 103 
     | 
    
         
            +
                    records.map{|datum| send(:new , datum)}
         
     | 
| 
      
 104 
     | 
    
         
            +
                  rescue => e
         
     | 
| 
      
 105 
     | 
    
         
            +
                    puts "#{e.class} :: #{e.message}"
         
     | 
| 
      
 106 
     | 
    
         
            +
                  end
         
     | 
| 
      
 107 
     | 
    
         
            +
                end
         
     | 
| 
      
 108 
     | 
    
         
            +
              end
         
     | 
| 
      
 109 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,16 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module JSONRecord
         
     | 
| 
      
 2 
     | 
    
         
            +
              class FileError < Errno::ENOENT
         
     | 
| 
      
 3 
     | 
    
         
            +
              end
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
              class JSONRecordError < StandardError
         
     | 
| 
      
 6 
     | 
    
         
            +
              end
         
     | 
| 
      
 7 
     | 
    
         
            +
              
         
     | 
| 
      
 8 
     | 
    
         
            +
              class AttributeError < NoMethodError
         
     | 
| 
      
 9 
     | 
    
         
            +
              end
         
     | 
| 
      
 10 
     | 
    
         
            +
              
         
     | 
| 
      
 11 
     | 
    
         
            +
              class RecordNotFound < JSONRecordError
         
     | 
| 
      
 12 
     | 
    
         
            +
              end
         
     | 
| 
      
 13 
     | 
    
         
            +
              
         
     | 
| 
      
 14 
     | 
    
         
            +
              class TableError < NameError
         
     | 
| 
      
 15 
     | 
    
         
            +
              end
         
     | 
| 
      
 16 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,100 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module JSONRecord
         
     | 
| 
      
 2 
     | 
    
         
            +
              class Base < JSONRecord::JSONHash
         
     | 
| 
      
 3 
     | 
    
         
            +
                attr_accessor :all_data
         
     | 
| 
      
 4 
     | 
    
         
            +
                
         
     | 
| 
      
 5 
     | 
    
         
            +
                def save
         
     | 
| 
      
 6 
     | 
    
         
            +
                  self.all_data = self.class.send(:all)
         
     | 
| 
      
 7 
     | 
    
         
            +
                  begin
         
     | 
| 
      
 8 
     | 
    
         
            +
                    raise FileError if path_finder.nil?
         
     | 
| 
      
 9 
     | 
    
         
            +
                    sanitize_input
         
     | 
| 
      
 10 
     | 
    
         
            +
                    self.keys.each {|key| raise AttributeError,"Unknown Attribute #{key}" unless column_names.include? key }
         
     | 
| 
      
 11 
     | 
    
         
            +
                    if self["id"].nil?
         
     | 
| 
      
 12 
     | 
    
         
            +
                      increment_table_id
         
     | 
| 
      
 13 
     | 
    
         
            +
                      self.all_data << self
         
     | 
| 
      
 14 
     | 
    
         
            +
                      persist_data
         
     | 
| 
      
 15 
     | 
    
         
            +
                    else
         
     | 
| 
      
 16 
     | 
    
         
            +
                      true #Returns already persists
         
     | 
| 
      
 17 
     | 
    
         
            +
                    end
         
     | 
| 
      
 18 
     | 
    
         
            +
                  rescue => e
         
     | 
| 
      
 19 
     | 
    
         
            +
                    return "#{e.message} for #{self.class}"
         
     | 
| 
      
 20 
     | 
    
         
            +
                  end
         
     | 
| 
      
 21 
     | 
    
         
            +
                end
         
     | 
| 
      
 22 
     | 
    
         
            +
                
         
     | 
| 
      
 23 
     | 
    
         
            +
                def new_record?
         
     | 
| 
      
 24 
     | 
    
         
            +
                  self["id"].nil? || self["id"] == 0
         
     | 
| 
      
 25 
     | 
    
         
            +
                end
         
     | 
| 
      
 26 
     | 
    
         
            +
                
         
     | 
| 
      
 27 
     | 
    
         
            +
                def persisted?
         
     | 
| 
      
 28 
     | 
    
         
            +
                  new_record? ? false : true
         
     | 
| 
      
 29 
     | 
    
         
            +
                end
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
                def model_name
         
     | 
| 
      
 32 
     | 
    
         
            +
                  self.class.model_name
         
     | 
| 
      
 33 
     | 
    
         
            +
                end
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
                def to_a
         
     | 
| 
      
 36 
     | 
    
         
            +
                  [self]
         
     | 
| 
      
 37 
     | 
    
         
            +
                end
         
     | 
| 
      
 38 
     | 
    
         
            +
                
         
     | 
| 
      
 39 
     | 
    
         
            +
                def update_attributes(attrs={})
         
     | 
| 
      
 40 
     | 
    
         
            +
                  self.all_data = self.class.send(:all)
         
     | 
| 
      
 41 
     | 
    
         
            +
                  unless attrs.empty?
         
     | 
| 
      
 42 
     | 
    
         
            +
                    sanitize_input(attrs)
         
     | 
| 
      
 43 
     | 
    
         
            +
                    attrs.each do |key,value| 
         
     | 
| 
      
 44 
     | 
    
         
            +
                      begin
         
     | 
| 
      
 45 
     | 
    
         
            +
                        raise AttributeError,"Unknown Attribute" unless column_names.include? key.to_s
         
     | 
| 
      
 46 
     | 
    
         
            +
                        data_type = self.class::COLUMN_ATTRIBUTES[self.class.to_s.downcase.pluralize].find{|i| i.first == key.to_s }
         
     | 
| 
      
 47 
     | 
    
         
            +
                        if data_type.last  == Array
         
     | 
| 
      
 48 
     | 
    
         
            +
                          if value.is_a?(String)
         
     | 
| 
      
 49 
     | 
    
         
            +
                            self[key.to_s] = instance_eval(value)
         
     | 
| 
      
 50 
     | 
    
         
            +
                          else
         
     | 
| 
      
 51 
     | 
    
         
            +
                            self[key.to_s] = value
         
     | 
| 
      
 52 
     | 
    
         
            +
                          end
         
     | 
| 
      
 53 
     | 
    
         
            +
                        elsif data_type.last  == Integer
         
     | 
| 
      
 54 
     | 
    
         
            +
                          self[key.to_s] = value.to_i
         
     | 
| 
      
 55 
     | 
    
         
            +
                        elsif data_type.last  == String
         
     | 
| 
      
 56 
     | 
    
         
            +
                          self[key.to_s] = value.to_s              
         
     | 
| 
      
 57 
     | 
    
         
            +
                        end
         
     | 
| 
      
 58 
     | 
    
         
            +
                      rescue => e
         
     | 
| 
      
 59 
     | 
    
         
            +
                        return "#{e.message} : #{key} => #{value}"
         
     | 
| 
      
 60 
     | 
    
         
            +
                      end
         
     | 
| 
      
 61 
     | 
    
         
            +
                    end
         
     | 
| 
      
 62 
     | 
    
         
            +
                    self.all_data[self.id.to_i.pred] = self
         
     | 
| 
      
 63 
     | 
    
         
            +
                    persist_data
         
     | 
| 
      
 64 
     | 
    
         
            +
                  end
         
     | 
| 
      
 65 
     | 
    
         
            +
                end
         
     | 
| 
      
 66 
     | 
    
         
            +
                
         
     | 
| 
      
 67 
     | 
    
         
            +
                def destroy
         
     | 
| 
      
 68 
     | 
    
         
            +
                  self.all_data = self.class.send(:all)
         
     | 
| 
      
 69 
     | 
    
         
            +
                  begin
         
     | 
| 
      
 70 
     | 
    
         
            +
                    raise FileError if path_finder.nil?
         
     | 
| 
      
 71 
     | 
    
         
            +
                    self.all_data.delete_if{|data| data.id == self.id }
         
     | 
| 
      
 72 
     | 
    
         
            +
                    persist_data
         
     | 
| 
      
 73 
     | 
    
         
            +
                  end
         
     | 
| 
      
 74 
     | 
    
         
            +
                end
         
     | 
| 
      
 75 
     | 
    
         
            +
             
     | 
| 
      
 76 
     | 
    
         
            +
                def to_key
         
     | 
| 
      
 77 
     | 
    
         
            +
                  persisted? ? [self.id] : nil
         
     | 
| 
      
 78 
     | 
    
         
            +
                end
         
     | 
| 
      
 79 
     | 
    
         
            +
             
     | 
| 
      
 80 
     | 
    
         
            +
                private
         
     | 
| 
      
 81 
     | 
    
         
            +
                def sanitize_input(attrs={})
         
     | 
| 
      
 82 
     | 
    
         
            +
                  if attrs.empty?
         
     | 
| 
      
 83 
     | 
    
         
            +
                    key_deletion(self)
         
     | 
| 
      
 84 
     | 
    
         
            +
                  else
         
     | 
| 
      
 85 
     | 
    
         
            +
                    key_deletion(attrs)
         
     | 
| 
      
 86 
     | 
    
         
            +
                  end
         
     | 
| 
      
 87 
     | 
    
         
            +
                end
         
     | 
| 
      
 88 
     | 
    
         
            +
             
     | 
| 
      
 89 
     | 
    
         
            +
                def key_deletion(hash)
         
     | 
| 
      
 90 
     | 
    
         
            +
                  hash.delete_if{|key| key.to_s == 'controller' or key.to_s == 'action' }
         
     | 
| 
      
 91 
     | 
    
         
            +
                end
         
     | 
| 
      
 92 
     | 
    
         
            +
             
     | 
| 
      
 93 
     | 
    
         
            +
                def persist_data
         
     | 
| 
      
 94 
     | 
    
         
            +
                  File.open(path_finder, "w+") do |file|
         
     | 
| 
      
 95 
     | 
    
         
            +
                    file.write(all_data.to_json)
         
     | 
| 
      
 96 
     | 
    
         
            +
                  end
         
     | 
| 
      
 97 
     | 
    
         
            +
                  self #Returns Deleted Object
         
     | 
| 
      
 98 
     | 
    
         
            +
                end
         
     | 
| 
      
 99 
     | 
    
         
            +
              end
         
     | 
| 
      
 100 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,34 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module JSONRecord
         
     | 
| 
      
 2 
     | 
    
         
            +
              def method_missing(name, *args , &block)
         
     | 
| 
      
 3 
     | 
    
         
            +
                if name.to_s[/^find_by_id$/]
         
     | 
| 
      
 4 
     | 
    
         
            +
                  find(args)
         
     | 
| 
      
 5 
     | 
    
         
            +
                elsif name.to_s[/^find_by_\w+/]
         
     | 
| 
      
 6 
     | 
    
         
            +
                  columns = $&.split('_by_').last.split('_and_')
         
     | 
| 
      
 7 
     | 
    
         
            +
                  begin
         
     | 
| 
      
 8 
     | 
    
         
            +
                    raise NoMethodError,"undefined method '#{$&}' for #{self}" unless (columns - self.column_names).empty?
         
     | 
| 
      
 9 
     | 
    
         
            +
                    raise ArgumentError, "wrong number of arguments #{args.size} for #{columns.size}" unless columns.size.eql?(args.size)
         
     | 
| 
      
 10 
     | 
    
         
            +
                    all.select { |record| record.select { |key| columns.include?(key) }.values == args }
         
     | 
| 
      
 11 
     | 
    
         
            +
                  rescue => e
         
     | 
| 
      
 12 
     | 
    
         
            +
                    "#{e.class} :: #{e.message}"
         
     | 
| 
      
 13 
     | 
    
         
            +
                  end
         
     | 
| 
      
 14 
     | 
    
         
            +
                elsif name.to_s[/^find_all_by_\w+/]
         
     | 
| 
      
 15 
     | 
    
         
            +
                  column = $&.split('_by_').last
         
     | 
| 
      
 16 
     | 
    
         
            +
                   begin
         
     | 
| 
      
 17 
     | 
    
         
            +
                     raise NoMethodError,"undefined method '#{column.last}' for #{self.class}" unless self.column_names.member?(column)
         
     | 
| 
      
 18 
     | 
    
         
            +
                     all.select{|record| record.send(column.intern) == args.first }
         
     | 
| 
      
 19 
     | 
    
         
            +
                   rescue => e
         
     | 
| 
      
 20 
     | 
    
         
            +
                     "#{e.class} :: #{e.message}"
         
     | 
| 
      
 21 
     | 
    
         
            +
                   end
         
     | 
| 
      
 22 
     | 
    
         
            +
                else
         
     | 
| 
      
 23 
     | 
    
         
            +
                  begin
         
     | 
| 
      
 24 
     | 
    
         
            +
                    unless name.to_s == "new"
         
     | 
| 
      
 25 
     | 
    
         
            +
                      raise NoMethodError,"undefined method '#{name}' for #{self}" unless self.column_names.include? name.to_s
         
     | 
| 
      
 26 
     | 
    
         
            +
                      raise ArgumentError, "wrong number of arguments #{args.size} for 0" unless args.empty?
         
     | 
| 
      
 27 
     | 
    
         
            +
                    end
         
     | 
| 
      
 28 
     | 
    
         
            +
                    return self[name.to_s] if self.column_names.include? name.to_s
         
     | 
| 
      
 29 
     | 
    
         
            +
                  rescue => e
         
     | 
| 
      
 30 
     | 
    
         
            +
                    puts "#{e.class} :: #{e.message}"
         
     | 
| 
      
 31 
     | 
    
         
            +
                  end
         
     | 
| 
      
 32 
     | 
    
         
            +
                end
         
     | 
| 
      
 33 
     | 
    
         
            +
              end
         
     | 
| 
      
 34 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,10 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module JSONRecord
         
     | 
| 
      
 2 
     | 
    
         
            +
              def define_class_and_instance_method(method_name, &block)
         
     | 
| 
      
 3 
     | 
    
         
            +
                define_method method_name, &block
         
     | 
| 
      
 4 
     | 
    
         
            +
                define_singleton_method method_name, &block
         
     | 
| 
      
 5 
     | 
    
         
            +
              end
         
     | 
| 
      
 6 
     | 
    
         
            +
              private
         
     | 
| 
      
 7 
     | 
    
         
            +
              def increment_table_id
         
     | 
| 
      
 8 
     | 
    
         
            +
                self.class.last.nil? ? self["id"] = 1 : self["id"] = self.class.last.id.next
         
     | 
| 
      
 9 
     | 
    
         
            +
              end
         
     | 
| 
      
 10 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,41 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module JSONRecord
         
     | 
| 
      
 2 
     | 
    
         
            +
              class Base < JSONHash
         
     | 
| 
      
 3 
     | 
    
         
            +
                def self.has_many(*args)
         
     | 
| 
      
 4 
     | 
    
         
            +
                  begin
         
     | 
| 
      
 5 
     | 
    
         
            +
                    args.each do |arg|
         
     | 
| 
      
 6 
     | 
    
         
            +
                      raise TableError,"Table Not Found : #{arg}" if JSON_TABLES["#{arg}.json"].nil?
         
     | 
| 
      
 7 
     | 
    
         
            +
                      self.class_eval(
         
     | 
| 
      
 8 
     | 
    
         
            +
                       <<-METHOD
         
     | 
| 
      
 9 
     | 
    
         
            +
                       def #{arg}
         
     | 
| 
      
 10 
     | 
    
         
            +
                         puts "#{self} has_many #{arg.to_s}"
         
     | 
| 
      
 11 
     | 
    
         
            +
                         object = "#{arg.to_s.capitalize.singularize}".constantize
         
     | 
| 
      
 12 
     | 
    
         
            +
                         object.find_by_#{self.to_s.downcase}_id(self.id.to_s)
         
     | 
| 
      
 13 
     | 
    
         
            +
                       end
         
     | 
| 
      
 14 
     | 
    
         
            +
                       METHOD
         
     | 
| 
      
 15 
     | 
    
         
            +
                     )
         
     | 
| 
      
 16 
     | 
    
         
            +
                    end
         
     | 
| 
      
 17 
     | 
    
         
            +
                  rescue => e
         
     | 
| 
      
 18 
     | 
    
         
            +
                    puts "#{e.class} : #{e.message}"
         
     | 
| 
      
 19 
     | 
    
         
            +
                  end
         
     | 
| 
      
 20 
     | 
    
         
            +
                end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                def self.belongs_to(*args)
         
     | 
| 
      
 23 
     | 
    
         
            +
                  begin
         
     | 
| 
      
 24 
     | 
    
         
            +
                    args.each do |arg|
         
     | 
| 
      
 25 
     | 
    
         
            +
                      raise TableError,"Table Not Found : #{arg}" if JSON_TABLES["#{arg.to_s.pluralize}.json"].nil?
         
     | 
| 
      
 26 
     | 
    
         
            +
                      self.class_eval(
         
     | 
| 
      
 27 
     | 
    
         
            +
                       <<-METHOD
         
     | 
| 
      
 28 
     | 
    
         
            +
                       def #{arg}
         
     | 
| 
      
 29 
     | 
    
         
            +
                         puts "#{self} belongs_to #{arg.to_s}"
         
     | 
| 
      
 30 
     | 
    
         
            +
                         object = "#{arg.to_s.capitalize}".constantize
         
     | 
| 
      
 31 
     | 
    
         
            +
                         object.find(self.#{arg.to_s}_id)
         
     | 
| 
      
 32 
     | 
    
         
            +
                       end
         
     | 
| 
      
 33 
     | 
    
         
            +
                       METHOD
         
     | 
| 
      
 34 
     | 
    
         
            +
                     )
         
     | 
| 
      
 35 
     | 
    
         
            +
                    end
         
     | 
| 
      
 36 
     | 
    
         
            +
                  rescue => e
         
     | 
| 
      
 37 
     | 
    
         
            +
                    puts "#{e.class} : #{e.message}"
         
     | 
| 
      
 38 
     | 
    
         
            +
                  end
         
     | 
| 
      
 39 
     | 
    
         
            +
                end
         
     | 
| 
      
 40 
     | 
    
         
            +
              end	
         
     | 
| 
      
 41 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/JSONRecord.rb
    ADDED
    
    | 
         @@ -0,0 +1,13 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require_relative 'loader'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module JSONRecord
         
     | 
| 
      
 4 
     | 
    
         
            +
              class Base < JSONRecord::JSONHash
         
     | 
| 
      
 5 
     | 
    
         
            +
                extend JSONRecord
         
     | 
| 
      
 6 
     | 
    
         
            +
                include JSONRecord
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
                def initialize(args={})
         
     | 
| 
      
 9 
     | 
    
         
            +
                  initialize_columns      
         
     | 
| 
      
 10 
     | 
    
         
            +
                  args.each{|column| self[column.first.to_s] = column.last }
         
     | 
| 
      
 11 
     | 
    
         
            +
                end
         
     | 
| 
      
 12 
     | 
    
         
            +
              end
         
     | 
| 
      
 13 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/loader.rb
    ADDED
    
    | 
         @@ -0,0 +1,15 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ["../JSONRecord/"].each{ |dir| $LOAD_PATH << File.expand_path(dir,__FILE__) }
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require 'version'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'yajl/json_gem'
         
     | 
| 
      
 5 
     | 
    
         
            +
            require 'active_model'
         
     | 
| 
      
 6 
     | 
    
         
            +
            require 'active_support'
         
     | 
| 
      
 7 
     | 
    
         
            +
            require 'errors'
         
     | 
| 
      
 8 
     | 
    
         
            +
            require 'json_hash'
         
     | 
| 
      
 9 
     | 
    
         
            +
            require 'json_schema'
         
     | 
| 
      
 10 
     | 
    
         
            +
            require 'class_methods'
         
     | 
| 
      
 11 
     | 
    
         
            +
            require 'module_methods'
         
     | 
| 
      
 12 
     | 
    
         
            +
            require 'instance_methods'
         
     | 
| 
      
 13 
     | 
    
         
            +
            require 'active_model_inclusions'
         
     | 
| 
      
 14 
     | 
    
         
            +
            require 'relation'
         
     | 
| 
      
 15 
     | 
    
         
            +
            require 'meth_missing'
         
     | 
| 
         Binary file 
     | 
    
        data/test/test_helper.rb
    ADDED
    
    
    
        metadata
    ADDED
    
    | 
         @@ -0,0 +1,111 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification
         
     | 
| 
      
 2 
     | 
    
         
            +
            name: JSONRecord
         
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.0.10
         
     | 
| 
      
 5 
     | 
    
         
            +
            platform: ruby
         
     | 
| 
      
 6 
     | 
    
         
            +
            authors:
         
     | 
| 
      
 7 
     | 
    
         
            +
            - Pankaj Doharey
         
     | 
| 
      
 8 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
      
 9 
     | 
    
         
            +
            bindir: bin
         
     | 
| 
      
 10 
     | 
    
         
            +
            cert_chain: []
         
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2013-03-13 00:00:00.000000000 Z
         
     | 
| 
      
 12 
     | 
    
         
            +
            dependencies:
         
     | 
| 
      
 13 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 14 
     | 
    
         
            +
              name: activesupport
         
     | 
| 
      
 15 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 16 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 17 
     | 
    
         
            +
                - - ~>
         
     | 
| 
      
 18 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 19 
     | 
    
         
            +
                    version: 3.2.8
         
     | 
| 
      
 20 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 21 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 22 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 23 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 24 
     | 
    
         
            +
                - - ~>
         
     | 
| 
      
 25 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 26 
     | 
    
         
            +
                    version: 3.2.8
         
     | 
| 
      
 27 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 28 
     | 
    
         
            +
              name: activemodel
         
     | 
| 
      
 29 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 30 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 31 
     | 
    
         
            +
                - - ~>
         
     | 
| 
      
 32 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 33 
     | 
    
         
            +
                    version: 3.2.8
         
     | 
| 
      
 34 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 35 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 36 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 37 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 38 
     | 
    
         
            +
                - - ~>
         
     | 
| 
      
 39 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 40 
     | 
    
         
            +
                    version: 3.2.8
         
     | 
| 
      
 41 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 42 
     | 
    
         
            +
              name: yajl-ruby
         
     | 
| 
      
 43 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 44 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 45 
     | 
    
         
            +
                - - ~>
         
     | 
| 
      
 46 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 47 
     | 
    
         
            +
                    version: 1.1.0
         
     | 
| 
      
 48 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 49 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 50 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 51 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 52 
     | 
    
         
            +
                - - ~>
         
     | 
| 
      
 53 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 54 
     | 
    
         
            +
                    version: 1.1.0
         
     | 
| 
      
 55 
     | 
    
         
            +
            description: JSON Data storage in ruby
         
     | 
| 
      
 56 
     | 
    
         
            +
            email:
         
     | 
| 
      
 57 
     | 
    
         
            +
            - pankajdoharey@gmail.com
         
     | 
| 
      
 58 
     | 
    
         
            +
            executables:
         
     | 
| 
      
 59 
     | 
    
         
            +
            - jsonrecord
         
     | 
| 
      
 60 
     | 
    
         
            +
            extensions: []
         
     | 
| 
      
 61 
     | 
    
         
            +
            extra_rdoc_files: []
         
     | 
| 
      
 62 
     | 
    
         
            +
            files:
         
     | 
| 
      
 63 
     | 
    
         
            +
            - .gitignore
         
     | 
| 
      
 64 
     | 
    
         
            +
            - Gemfile
         
     | 
| 
      
 65 
     | 
    
         
            +
            - JSONRecord.gemspec
         
     | 
| 
      
 66 
     | 
    
         
            +
            - LICENSE.txt
         
     | 
| 
      
 67 
     | 
    
         
            +
            - README.md
         
     | 
| 
      
 68 
     | 
    
         
            +
            - Rakefile
         
     | 
| 
      
 69 
     | 
    
         
            +
            - bin/jsonrecord
         
     | 
| 
      
 70 
     | 
    
         
            +
            - lib/JSONRecord.rb
         
     | 
| 
      
 71 
     | 
    
         
            +
            - lib/JSONRecord/active_model_inclusions.rb
         
     | 
| 
      
 72 
     | 
    
         
            +
            - lib/JSONRecord/class_methods.rb
         
     | 
| 
      
 73 
     | 
    
         
            +
            - lib/JSONRecord/errors.rb
         
     | 
| 
      
 74 
     | 
    
         
            +
            - lib/JSONRecord/instance_methods.rb
         
     | 
| 
      
 75 
     | 
    
         
            +
            - lib/JSONRecord/json_hash.rb
         
     | 
| 
      
 76 
     | 
    
         
            +
            - lib/JSONRecord/json_schema.rb
         
     | 
| 
      
 77 
     | 
    
         
            +
            - lib/JSONRecord/meth_missing.rb
         
     | 
| 
      
 78 
     | 
    
         
            +
            - lib/JSONRecord/module_methods.rb
         
     | 
| 
      
 79 
     | 
    
         
            +
            - lib/JSONRecord/relation.rb
         
     | 
| 
      
 80 
     | 
    
         
            +
            - lib/JSONRecord/version.rb
         
     | 
| 
      
 81 
     | 
    
         
            +
            - lib/loader.rb
         
     | 
| 
      
 82 
     | 
    
         
            +
            - lib/tables/.DS_Store
         
     | 
| 
      
 83 
     | 
    
         
            +
            - test/lib/jsonrecord/version_test.rb
         
     | 
| 
      
 84 
     | 
    
         
            +
            - test/test_helper.rb
         
     | 
| 
      
 85 
     | 
    
         
            +
            homepage: http://jsondb.codemismatch.com
         
     | 
| 
      
 86 
     | 
    
         
            +
            licenses: []
         
     | 
| 
      
 87 
     | 
    
         
            +
            metadata: {}
         
     | 
| 
      
 88 
     | 
    
         
            +
            post_install_message: 
         
     | 
| 
      
 89 
     | 
    
         
            +
            rdoc_options: []
         
     | 
| 
      
 90 
     | 
    
         
            +
            require_paths:
         
     | 
| 
      
 91 
     | 
    
         
            +
            - lib
         
     | 
| 
      
 92 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 93 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 94 
     | 
    
         
            +
              - - ! '>='
         
     | 
| 
      
 95 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 96 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 97 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 98 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 99 
     | 
    
         
            +
              - - ! '>='
         
     | 
| 
      
 100 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 101 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 102 
     | 
    
         
            +
            requirements: []
         
     | 
| 
      
 103 
     | 
    
         
            +
            rubyforge_project: 
         
     | 
| 
      
 104 
     | 
    
         
            +
            rubygems_version: 2.0.3
         
     | 
| 
      
 105 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
      
 106 
     | 
    
         
            +
            specification_version: 4
         
     | 
| 
      
 107 
     | 
    
         
            +
            summary: JSONRecord is a minimal document storage for rails, with an active record
         
     | 
| 
      
 108 
     | 
    
         
            +
              style query interface.
         
     | 
| 
      
 109 
     | 
    
         
            +
            test_files:
         
     | 
| 
      
 110 
     | 
    
         
            +
            - test/lib/jsonrecord/version_test.rb
         
     | 
| 
      
 111 
     | 
    
         
            +
            - test/test_helper.rb
         
     |