asana2flowdock 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +58 -0
- data/README.md +85 -0
- data/Rakefile +394 -0
- data/a.rb +336 -0
- data/a.yml +6 -0
- data/asana2flowdock.gemspec +1878 -0
- data/bin/amalgalite-pack +16 -0
- data/bin/asana2flowdock +274 -0
- data/bin/asana2flowdock-daemon +16 -0
- data/bin/coderay +16 -0
- data/bin/httparty +16 -0
- data/bin/pry +16 -0
- data/bin/sekrets +16 -0
- data/bin/sequel +16 -0
- data/config/asana2flowdock.yml.enc +2 -0
- data/lib/asana2flowdock.rb +98 -0
- data/lib/asana2flowdock/asana.rb +225 -0
- data/vendor/bundle/ruby/1.9.1/bin/amalgalite-pack +23 -0
- data/vendor/bundle/ruby/1.9.1/bin/asana2flowdock +23 -0
- data/vendor/bundle/ruby/1.9.1/bin/asana2flowdock-daemon +23 -0
- data/vendor/bundle/ruby/1.9.1/bin/coderay +23 -0
- data/vendor/bundle/ruby/1.9.1/bin/httparty +23 -0
- data/vendor/bundle/ruby/1.9.1/bin/pry +23 -0
- data/vendor/bundle/ruby/1.9.1/bin/sekrets +23 -0
- data/vendor/bundle/ruby/1.9.1/bin/sequel +23 -0
- data/vendor/bundle/ruby/1.9.1/build_info/amalgalite-1.3.0.info +1 -0
- data/vendor/bundle/ruby/1.9.1/build_info/arrayfields-4.7.4.info +1 -0
- data/vendor/bundle/ruby/1.9.1/build_info/chronic-0.10.2.info +1 -0
- data/vendor/bundle/ruby/1.9.1/build_info/coderay-1.1.0.info +1 -0
- data/vendor/bundle/ruby/1.9.1/build_info/coerce-0.0.6.info +1 -0
- data/vendor/bundle/ruby/1.9.1/build_info/daemons-1.1.9.info +1 -0
- data/vendor/bundle/ruby/1.9.1/build_info/fastercsv-1.5.5.info +1 -0
- data/vendor/bundle/ruby/1.9.1/build_info/fattr-2.2.2.info +1 -0
- data/vendor/bundle/ruby/1.9.1/build_info/flowdock-0.5.0.info +1 -0
- data/vendor/bundle/ruby/1.9.1/build_info/highline-1.6.21.info +1 -0
- data/vendor/bundle/ruby/1.9.1/build_info/httparty-0.13.1.info +1 -0
- data/vendor/bundle/ruby/1.9.1/build_info/json-1.8.1.info +1 -0
- data/vendor/bundle/ruby/1.9.1/build_info/main-6.0.0.info +1 -0
- data/vendor/bundle/ruby/1.9.1/build_info/main-6.1.0.info +1 -0
- data/vendor/bundle/ruby/1.9.1/build_info/map-6.5.5.info +1 -0
- data/vendor/bundle/ruby/1.9.1/build_info/method_source-0.8.2.info +1 -0
- data/vendor/bundle/ruby/1.9.1/build_info/multi_json-1.10.1.info +1 -0
- data/vendor/bundle/ruby/1.9.1/build_info/multi_xml-0.5.5.info +1 -0
- data/vendor/bundle/ruby/1.9.1/build_info/pry-0.9.12.6.info +1 -0
- data/vendor/bundle/ruby/1.9.1/build_info/sekrets-1.7.0.info +1 -0
- data/vendor/bundle/ruby/1.9.1/build_info/sequel-4.15.0.info +1 -0
- data/vendor/bundle/ruby/1.9.1/build_info/slop-3.5.0.info +1 -0
- data/vendor/bundle/ruby/1.9.1/build_info/threadify-1.3.0.info +1 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/CONTRIBUTING.md +49 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/HISTORY.md +315 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/LICENSE +29 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/Manifest.txt +104 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/README.md +73 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/Rakefile +25 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/TODO.md +50 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/bin/amalgalite-pack +147 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/examples/a.rb +9 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/examples/blob.rb +88 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/examples/bootstrap.rb +36 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/examples/define_aggregate.rb +75 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/examples/define_function.rb +104 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/examples/fts3.rb +144 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/examples/gem-db.rb +94 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/examples/require_me.rb +11 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/examples/requires.rb +42 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/examples/schema-info.rb +34 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/ext/amalgalite/c/Makefile +220 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/ext/amalgalite/c/amalgalite.bundle +0 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/ext/amalgalite/c/amalgalite.c +329 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/ext/amalgalite/c/amalgalite.h +151 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/ext/amalgalite/c/amalgalite.o +0 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/ext/amalgalite/c/amalgalite_blob.c +240 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/ext/amalgalite/c/amalgalite_blob.o +0 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/ext/amalgalite/c/amalgalite_constants.c +378 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/ext/amalgalite/c/amalgalite_constants.o +0 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/ext/amalgalite/c/amalgalite_database.c +1177 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/ext/amalgalite/c/amalgalite_database.o +0 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/ext/amalgalite/c/amalgalite_requires_bootstrap.c +282 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/ext/amalgalite/c/amalgalite_requires_bootstrap.o +0 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/ext/amalgalite/c/amalgalite_statement.c +649 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/ext/amalgalite/c/amalgalite_statement.o +0 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/ext/amalgalite/c/extconf.rb +36 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/ext/amalgalite/c/gen_constants.rb +193 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/ext/amalgalite/c/notes.txt +134 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/ext/amalgalite/c/sqlite3.c +137414 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/ext/amalgalite/c/sqlite3.h +7160 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/ext/amalgalite/c/sqlite3.o +0 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/ext/amalgalite/c/sqlite3_options.h +4 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/ext/amalgalite/c/sqlite3ext.h +447 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite.rb +51 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/1.9/amalgalite.bundle +0 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/aggregate.rb +67 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/blob.rb +186 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/boolean.rb +42 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/busy_timeout.rb +47 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/column.rb +99 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/core_ext/kernel/require.rb +21 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/csv_table_importer.rb +74 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/database.rb +984 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/function.rb +61 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/index.rb +43 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/memory_database.rb +15 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/packer.rb +231 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/paths.rb +80 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/profile_tap.rb +131 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/progress_handler.rb +21 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/requires.rb +151 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/schema.rb +225 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/sqlite3.rb +6 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/sqlite3/constants.rb +95 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/sqlite3/database/function.rb +48 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/sqlite3/database/status.rb +68 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/sqlite3/status.rb +60 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/sqlite3/version.rb +55 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/statement.rb +418 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/table.rb +91 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/taps.rb +2 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/taps/console.rb +27 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/taps/io.rb +71 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/trace_tap.rb +35 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/type_map.rb +63 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/type_maps/default_map.rb +166 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/type_maps/storage_map.rb +38 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/type_maps/text_map.rb +21 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/version.rb +8 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/view.rb +26 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/aggregate_spec.rb +150 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/amalgalite_spec.rb +4 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/blob_spec.rb +78 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/boolean_spec.rb +24 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/busy_handler.rb +157 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/data/iso-3166-country.txt +242 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/data/iso-3166-schema.sql +22 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/data/iso-3166-subcountry.txt +3995 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/data/make-iso-db.sh +12 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/database_spec.rb +510 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/default_map_spec.rb +92 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/function_spec.rb +78 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/integeration_spec.rb +97 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/iso_3166_database.rb +58 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/packer_spec.rb +60 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/paths_spec.rb +28 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/progress_handler_spec.rb +91 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/requires_spec.rb +54 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/rtree_spec.rb +66 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/schema_spec.rb +131 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/spec_helper.rb +43 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/sqlite3/constants_spec.rb +108 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/sqlite3/database_status_spec.rb +36 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/sqlite3/status_spec.rb +22 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/sqlite3/version_spec.rb +22 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/sqlite3_spec.rb +53 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/statement_spec.rb +168 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/storage_map_spec.rb +38 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/tap_spec.rb +57 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/text_map_spec.rb +20 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/type_map_spec.rb +14 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/version_spec.rb +8 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/tasks/custom.rake +99 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/tasks/default.rake +277 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/tasks/extension.rake +38 -0
- data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/tasks/this.rb +209 -0
- data/vendor/bundle/ruby/1.9.1/gems/arrayfields-4.7.4/README +378 -0
- data/vendor/bundle/ruby/1.9.1/gems/arrayfields-4.7.4/arrayfields.gemspec +26 -0
- data/vendor/bundle/ruby/1.9.1/gems/arrayfields-4.7.4/gemspec.rb +62 -0
- data/vendor/bundle/ruby/1.9.1/gems/arrayfields-4.7.4/install.rb +206 -0
- data/vendor/bundle/ruby/1.9.1/gems/arrayfields-4.7.4/lib/arrayfields.rb +443 -0
- data/vendor/bundle/ruby/1.9.1/gems/arrayfields-4.7.4/readme.rb +248 -0
- data/vendor/bundle/ruby/1.9.1/gems/arrayfields-4.7.4/sample/a.rb +40 -0
- data/vendor/bundle/ruby/1.9.1/gems/arrayfields-4.7.4/sample/b.rb +16 -0
- data/vendor/bundle/ruby/1.9.1/gems/arrayfields-4.7.4/sample/c.rb +9 -0
- data/vendor/bundle/ruby/1.9.1/gems/arrayfields-4.7.4/sample/d.rb +25 -0
- data/vendor/bundle/ruby/1.9.1/gems/arrayfields-4.7.4/sample/e.rb +15 -0
- data/vendor/bundle/ruby/1.9.1/gems/arrayfields-4.7.4/test/arrayfields.rb +324 -0
- data/vendor/bundle/ruby/1.9.1/gems/arrayfields-4.7.4/test/memtest.rb +41 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/HISTORY.md +243 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/LICENSE +21 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/README.md +182 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/Rakefile +66 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/chronic.gemspec +23 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic.rb +150 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/date.rb +82 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/grabber.rb +33 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/handler.rb +97 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/handlers.rb +647 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/mini_date.rb +38 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/numerizer.rb +130 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/ordinal.rb +49 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/parser.rb +268 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/pointer.rb +32 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/repeater.rb +145 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/repeaters/repeater_day.rb +54 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/repeaters/repeater_day_name.rb +53 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/repeaters/repeater_day_portion.rb +109 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/repeaters/repeater_fortnight.rb +72 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/repeaters/repeater_hour.rb +59 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/repeaters/repeater_minute.rb +59 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/repeaters/repeater_month.rb +80 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/repeaters/repeater_month_name.rb +95 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/repeaters/repeater_season.rb +111 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/repeaters/repeater_season_name.rb +43 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/repeaters/repeater_second.rb +43 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/repeaters/repeater_time.rb +138 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/repeaters/repeater_week.rb +75 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/repeaters/repeater_weekday.rb +86 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/repeaters/repeater_weekend.rb +67 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/repeaters/repeater_year.rb +78 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/scalar.rb +81 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/season.rb +26 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/separator.rb +207 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/sign.rb +49 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/span.rb +31 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/tag.rb +37 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/time.rb +40 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/time_zone.rb +32 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/token.rb +51 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/test/helper.rb +12 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/test/test_chronic.rb +183 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/test/test_daylight_savings.rb +118 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/test/test_handler.rb +128 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/test/test_mini_date.rb +32 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/test/test_numerizer.rb +86 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/test/test_parsing.rb +1235 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/test/test_repeater_day_name.rb +51 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/test/test_repeater_day_portion.rb +254 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/test/test_repeater_fortnight.rb +62 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/test/test_repeater_hour.rb +68 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/test/test_repeater_minute.rb +34 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/test/test_repeater_month.rb +50 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/test/test_repeater_month_name.rb +56 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/test/test_repeater_season.rb +40 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/test/test_repeater_time.rb +88 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/test/test_repeater_week.rb +62 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/test/test_repeater_weekday.rb +55 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/test/test_repeater_weekend.rb +74 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/test/test_repeater_year.rb +69 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/test/test_span.rb +23 -0
- data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/test/test_token.rb +25 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/README_INDEX.rdoc +123 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/Rakefile +37 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/bin/coderay +215 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay.rb +284 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/duo.rb +81 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/encoder.rb +201 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/encoders/_map.rb +17 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/encoders/comment_filter.rb +25 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/encoders/count.rb +39 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/encoders/debug.rb +49 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/encoders/debug_lint.rb +63 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/encoders/div.rb +23 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/encoders/filter.rb +58 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/encoders/html.rb +332 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/encoders/html/css.rb +65 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/encoders/html/numbering.rb +108 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/encoders/html/output.rb +166 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/encoders/json.rb +83 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/encoders/lines_of_code.rb +45 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/encoders/lint.rb +59 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/encoders/null.rb +18 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/encoders/page.rb +24 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/encoders/span.rb +23 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/encoders/statistic.rb +95 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/encoders/terminal.rb +195 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/encoders/text.rb +46 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/encoders/token_kind_filter.rb +111 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/encoders/xml.rb +72 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/encoders/yaml.rb +50 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/for_redcloth.rb +95 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/helpers/file_type.rb +151 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/helpers/plugin.rb +274 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/helpers/word_list.rb +72 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanner.rb +355 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/_map.rb +24 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/c.rb +189 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/clojure.rb +217 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/cpp.rb +215 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/css.rb +196 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/debug.rb +75 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/delphi.rb +144 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/diff.rb +221 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/erb.rb +81 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/go.rb +208 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/groovy.rb +268 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/haml.rb +168 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/html.rb +275 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/java.rb +174 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/java/builtin_types.rb +421 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/java_script.rb +237 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/json.rb +98 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/lua.rb +280 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/php.rb +527 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/python.rb +287 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/raydebug.rb +75 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/ruby.rb +470 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/ruby/patterns.rb +178 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/ruby/string_state.rb +71 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/sass.rb +232 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/sql.rb +177 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/taskpaper.rb +36 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/text.rb +26 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/xml.rb +17 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/yaml.rb +140 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/style.rb +23 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/styles/_map.rb +7 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/styles/alpha.rb +152 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/token_kinds.rb +85 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/tokens.rb +161 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/tokens_proxy.rb +55 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/version.rb +3 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/test/functional/basic.rb +318 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/test/functional/examples.rb +129 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/test/functional/for_redcloth.rb +78 -0
- data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/test/functional/suite.rb +15 -0
- data/vendor/bundle/ruby/1.9.1/gems/coerce-0.0.6/README +28 -0
- data/vendor/bundle/ruby/1.9.1/gems/coerce-0.0.6/Rakefile +392 -0
- data/vendor/bundle/ruby/1.9.1/gems/coerce-0.0.6/coerce.gemspec +31 -0
- data/vendor/bundle/ruby/1.9.1/gems/coerce-0.0.6/lib/coerce.rb +210 -0
- data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/LICENSE +22 -0
- data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/README +214 -0
- data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/Rakefile +90 -0
- data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/Releases +195 -0
- data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/TODO +2 -0
- data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/examples/call/call.rb +57 -0
- data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/examples/call/call_monitor.rb +55 -0
- data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/examples/daemonize/daemonize.rb +27 -0
- data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/examples/run/ctrl_crash.rb +17 -0
- data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/examples/run/ctrl_exec.rb +16 -0
- data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/examples/run/ctrl_exit.rb +15 -0
- data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/examples/run/ctrl_hanging.rb +19 -0
- data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/examples/run/ctrl_keep_pid_files.rb +17 -0
- data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/examples/run/ctrl_monitor.rb +16 -0
- data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/examples/run/ctrl_multiple.rb +16 -0
- data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/examples/run/ctrl_normal.rb +11 -0
- data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/examples/run/ctrl_ontop.rb +16 -0
- data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/examples/run/ctrl_optionparser.rb +43 -0
- data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/examples/run/ctrl_proc.rb +25 -0
- data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/examples/run/ctrl_proc_multiple.rb +22 -0
- data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/examples/run/ctrl_proc_rand.rb +23 -0
- data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/examples/run/ctrl_proc_simple.rb +17 -0
- data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/examples/run/ctrl_slowstop.rb +16 -0
- data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/examples/run/myserver.rb +12 -0
- data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/examples/run/myserver_crashing.rb +14 -0
- data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/examples/run/myserver_exiting.rb +8 -0
- data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/examples/run/myserver_hanging.rb +21 -0
- data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/examples/run/myserver_slowstop.rb +21 -0
- data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/lib/daemons.rb +315 -0
- data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/lib/daemons/application.rb +477 -0
- data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/lib/daemons/application_group.rb +194 -0
- data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/lib/daemons/change_privilege.rb +19 -0
- data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/lib/daemons/cmdline.rb +121 -0
- data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/lib/daemons/controller.rb +140 -0
- data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/lib/daemons/daemonize.rb +169 -0
- data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/lib/daemons/etc_extension.rb +12 -0
- data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/lib/daemons/exceptions.rb +28 -0
- data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/lib/daemons/monitor.rb +138 -0
- data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/lib/daemons/pid.rb +108 -0
- data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/lib/daemons/pidfile.rb +116 -0
- data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/lib/daemons/pidmem.rb +19 -0
- data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/setup.rb +1360 -0
- data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/AUTHORS +1 -0
- data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/CHANGELOG +182 -0
- data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/COPYING +340 -0
- data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/INSTALL +33 -0
- data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/LICENSE +9 -0
- data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/README +71 -0
- data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/Rakefile +94 -0
- data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/TODO +6 -0
- data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/examples/csv_converters.rb +28 -0
- data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/examples/csv_filter.rb +23 -0
- data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/examples/csv_reading.rb +57 -0
- data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/examples/csv_table.rb +56 -0
- data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/examples/csv_writing.rb +67 -0
- data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/examples/purchase.csv +3 -0
- data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/examples/shortcut_interface.rb +36 -0
- data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/lib/faster_csv.rb +2025 -0
- data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/lib/fastercsv.rb +10 -0
- data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/test/line_endings.gz +0 -0
- data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/test/tc_csv_parsing.rb +191 -0
- data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/test/tc_csv_writing.rb +96 -0
- data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/test/tc_data_converters.rb +260 -0
- data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/test/tc_encodings.rb +23 -0
- data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/test/tc_features.rb +212 -0
- data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/test/tc_headers.rb +277 -0
- data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/test/tc_interface.rb +376 -0
- data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/test/tc_row.rb +305 -0
- data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/test/tc_serialization.rb +154 -0
- data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/test/tc_speed.rb +65 -0
- data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/test/tc_table.rb +408 -0
- data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/test/test_data.csv +1000 -0
- data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/test/ts_all.rb +20 -0
- data/vendor/bundle/ruby/1.9.1/gems/fattr-2.2.2/LICENSE +1 -0
- data/vendor/bundle/ruby/1.9.1/gems/fattr-2.2.2/README +347 -0
- data/vendor/bundle/ruby/1.9.1/gems/fattr-2.2.2/README.erb +82 -0
- data/vendor/bundle/ruby/1.9.1/gems/fattr-2.2.2/Rakefile +376 -0
- data/vendor/bundle/ruby/1.9.1/gems/fattr-2.2.2/lib/fattr.rb +206 -0
- data/vendor/bundle/ruby/1.9.1/gems/fattr-2.2.2/samples/a.rb +21 -0
- data/vendor/bundle/ruby/1.9.1/gems/fattr-2.2.2/samples/b.rb +22 -0
- data/vendor/bundle/ruby/1.9.1/gems/fattr-2.2.2/samples/c.rb +12 -0
- data/vendor/bundle/ruby/1.9.1/gems/fattr-2.2.2/samples/d.rb +34 -0
- data/vendor/bundle/ruby/1.9.1/gems/fattr-2.2.2/samples/e.rb +17 -0
- data/vendor/bundle/ruby/1.9.1/gems/fattr-2.2.2/samples/f.rb +21 -0
- data/vendor/bundle/ruby/1.9.1/gems/fattr-2.2.2/samples/g.rb +15 -0
- data/vendor/bundle/ruby/1.9.1/gems/fattr-2.2.2/samples/h.rb +29 -0
- data/vendor/bundle/ruby/1.9.1/gems/fattr-2.2.2/test/fattr_test.rb +173 -0
- data/vendor/bundle/ruby/1.9.1/gems/flowdock-0.5.0/Gemfile +16 -0
- data/vendor/bundle/ruby/1.9.1/gems/flowdock-0.5.0/LICENSE +20 -0
- data/vendor/bundle/ruby/1.9.1/gems/flowdock-0.5.0/README.md +145 -0
- data/vendor/bundle/ruby/1.9.1/gems/flowdock-0.5.0/Rakefile +43 -0
- data/vendor/bundle/ruby/1.9.1/gems/flowdock-0.5.0/VERSION +1 -0
- data/vendor/bundle/ruby/1.9.1/gems/flowdock-0.5.0/flowdock.gemspec +73 -0
- data/vendor/bundle/ruby/1.9.1/gems/flowdock-0.5.0/lib/flowdock.rb +181 -0
- data/vendor/bundle/ruby/1.9.1/gems/flowdock-0.5.0/lib/flowdock/capistrano.rb +1 -0
- data/vendor/bundle/ruby/1.9.1/gems/flowdock-0.5.0/spec/flowdock_spec.rb +435 -0
- data/vendor/bundle/ruby/1.9.1/gems/flowdock-0.5.0/spec/spec_helper.rb +14 -0
- data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/AUTHORS +3 -0
- data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/CHANGELOG +357 -0
- data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/COPYING +340 -0
- data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/INSTALL +55 -0
- data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/LICENSE +7 -0
- data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/README.rdoc +67 -0
- data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/Rakefile +50 -0
- data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/TODO +6 -0
- data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/examples/ansi_colors.rb +38 -0
- data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/examples/asking_for_arrays.rb +18 -0
- data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/examples/basic_usage.rb +75 -0
- data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/examples/color_scheme.rb +32 -0
- data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/examples/get_character.rb +12 -0
- data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/examples/limit.rb +12 -0
- data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/examples/menus.rb +65 -0
- data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/examples/overwrite.rb +19 -0
- data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/examples/page_and_wrap.rb +322 -0
- data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/examples/password.rb +7 -0
- data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/examples/repeat_entry.rb +21 -0
- data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/examples/trapping_eof.rb +22 -0
- data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/examples/using_readline.rb +17 -0
- data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/highline.gemspec +37 -0
- data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/lib/highline.rb +1034 -0
- data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/lib/highline/color_scheme.rb +134 -0
- data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/lib/highline/compatibility.rb +16 -0
- data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/lib/highline/import.rb +41 -0
- data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/lib/highline/menu.rb +381 -0
- data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/lib/highline/question.rb +481 -0
- data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/lib/highline/simulate.rb +48 -0
- data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/lib/highline/string_extensions.rb +111 -0
- data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/lib/highline/style.rb +181 -0
- data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/lib/highline/system_extensions.rb +242 -0
- data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/setup.rb +1360 -0
- data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/site/highline.css +65 -0
- data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/site/images/logo.png +0 -0
- data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/site/index.html +58 -0
- data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/test/string_methods.rb +32 -0
- data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/test/tc_color_scheme.rb +96 -0
- data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/test/tc_highline.rb +1134 -0
- data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/test/tc_import.rb +52 -0
- data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/test/tc_menu.rb +439 -0
- data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/test/tc_string_extension.rb +20 -0
- data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/test/tc_string_highline.rb +38 -0
- data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/test/tc_style.rb +567 -0
- data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/test/ts_all.rb +16 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/Gemfile +14 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/Guardfile +16 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/History +303 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/MIT-LICENSE +20 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/README.md +74 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/Rakefile +12 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/bin/httparty +117 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/cucumber.yml +1 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/examples/aaws.rb +32 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/examples/basic.rb +28 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/examples/crack.rb +19 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/examples/custom_parsers.rb +67 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/examples/delicious.rb +37 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/examples/google.rb +16 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/examples/headers_and_user_agents.rb +6 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/examples/nokogiri_html_parser.rb +22 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/examples/rubyurl.rb +14 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/examples/stackexchange.rb +24 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/examples/tripit_sign_in.rb +33 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/examples/twitter.rb +31 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/examples/whoismyrep.rb +10 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/features/basic_authentication.feature +20 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/features/command_line.feature +7 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/features/deals_with_http_error_codes.feature +26 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/features/digest_authentication.feature +20 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/features/handles_compressed_responses.feature +27 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/features/handles_multiple_formats.feature +57 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/features/steps/env.rb +22 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/features/steps/httparty_response_steps.rb +52 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/features/steps/httparty_steps.rb +43 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/features/steps/mongrel_helper.rb +94 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/features/steps/remote_service_steps.rb +74 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/features/supports_read_timeout_option.feature +13 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/features/supports_redirection.feature +22 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/features/supports_timeout_option.feature +13 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/httparty.gemspec +26 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/lib/httparty.rb +600 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/lib/httparty/connection_adapter.rb +187 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/lib/httparty/cookie_hash.rb +22 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/lib/httparty/core_extensions.rb +32 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/lib/httparty/exceptions.rb +29 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/lib/httparty/hash_conversions.rb +51 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/lib/httparty/logger/apache_logger.rb +22 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/lib/httparty/logger/curl_logger.rb +48 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/lib/httparty/logger/logger.rb +18 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/lib/httparty/module_inheritable_attributes.rb +56 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/lib/httparty/net_digest_auth.rb +84 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/lib/httparty/parser.rb +141 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/lib/httparty/request.rb +331 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/lib/httparty/response.rb +72 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/lib/httparty/response/headers.rb +31 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/lib/httparty/version.rb +3 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/script/release +42 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/fixtures/delicious.xml +23 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/fixtures/empty.xml +0 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/fixtures/google.html +3 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/fixtures/ssl/generate.sh +29 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/fixtures/ssl/generated/1fe462c2.0 +16 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/fixtures/ssl/generated/bogushost.crt +13 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/fixtures/ssl/generated/ca.crt +16 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/fixtures/ssl/generated/ca.key +15 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/fixtures/ssl/generated/selfsigned.crt +14 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/fixtures/ssl/generated/server.crt +13 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/fixtures/ssl/generated/server.key +15 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/fixtures/ssl/openssl-exts.cnf +9 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/fixtures/twitter.csv +2 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/fixtures/twitter.json +1 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/fixtures/twitter.xml +403 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/fixtures/undefined_method_add_node_for_nil.xml +2 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/httparty/connection_adapter_spec.rb +354 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/httparty/cookie_hash_spec.rb +83 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/httparty/exception_spec.rb +23 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/httparty/logger/apache_logger_spec.rb +26 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/httparty/logger/curl_logger_spec.rb +18 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/httparty/logger/logger_spec.rb +22 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/httparty/net_digest_auth_spec.rb +152 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/httparty/parser_spec.rb +165 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/httparty/request_spec.rb +638 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/httparty/response_spec.rb +221 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/httparty/ssl_spec.rb +74 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/httparty_spec.rb +764 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/spec.opts +2 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/spec_helper.rb +37 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/support/ssl_test_helper.rb +47 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/support/ssl_test_server.rb +80 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/support/stub_response.rb +43 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/website/css/common.css +47 -0
- data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/website/index.html +73 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/CHANGES +284 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/COPYING +58 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/COPYING-json-jruby +57 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/GPL +340 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/Gemfile +11 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/README-json-jruby.markdown +33 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/README.rdoc +358 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/Rakefile +412 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/TODO +1 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/VERSION +1 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/data/example.json +1 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/data/index.html +38 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/data/prototype.js +4184 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/ext/json/ext/fbuffer/fbuffer.h +181 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/ext/json/ext/generator/Makefile +221 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/ext/json/ext/generator/depend +1 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/ext/json/ext/generator/extconf.rb +14 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/ext/json/ext/generator/generator.bundle +0 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/ext/json/ext/generator/generator.c +1435 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/ext/json/ext/generator/generator.h +148 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/ext/json/ext/generator/generator.o +0 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/ext/json/ext/parser/Makefile +221 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/ext/json/ext/parser/depend +1 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/ext/json/ext/parser/extconf.rb +13 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/ext/json/ext/parser/parser.bundle +0 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/ext/json/ext/parser/parser.c +2204 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/ext/json/ext/parser/parser.h +77 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/ext/json/ext/parser/parser.o +0 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/ext/json/ext/parser/parser.rl +927 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/install.rb +23 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/java/src/json/ext/ByteListTranscoder.java +167 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/java/src/json/ext/Generator.java +444 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/java/src/json/ext/GeneratorMethods.java +232 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/java/src/json/ext/GeneratorService.java +43 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/java/src/json/ext/GeneratorState.java +543 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/java/src/json/ext/OptionsReader.java +114 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/java/src/json/ext/Parser.java +2644 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/java/src/json/ext/Parser.rl +968 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/java/src/json/ext/ParserService.java +35 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/java/src/json/ext/RuntimeInfo.java +121 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/java/src/json/ext/StringDecoder.java +167 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/java/src/json/ext/StringEncoder.java +106 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/java/src/json/ext/Utils.java +89 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/json-java.gemspec +23 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/json.gemspec +38 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/json_pure.gemspec +40 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/lib/json.rb +62 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/lib/json/add/bigdecimal.rb +28 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/lib/json/add/complex.rb +22 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/lib/json/add/core.rb +11 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/lib/json/add/date.rb +34 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/lib/json/add/date_time.rb +50 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/lib/json/add/exception.rb +31 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/lib/json/add/ostruct.rb +31 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/lib/json/add/range.rb +29 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/lib/json/add/rational.rb +22 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/lib/json/add/regexp.rb +30 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/lib/json/add/struct.rb +30 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/lib/json/add/symbol.rb +25 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/lib/json/add/time.rb +38 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/lib/json/common.rb +484 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/lib/json/ext.rb +21 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/lib/json/ext/generator.bundle +0 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/lib/json/ext/parser.bundle +0 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/lib/json/generic_object.rb +70 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/lib/json/pure.rb +21 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/lib/json/pure/generator.rb +522 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/lib/json/pure/parser.rb +359 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/lib/json/version.rb +8 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/fail1.json +1 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/fail10.json +1 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/fail11.json +1 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/fail12.json +1 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/fail13.json +1 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/fail14.json +1 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/fail18.json +1 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/fail19.json +1 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/fail2.json +1 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/fail20.json +1 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/fail21.json +1 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/fail22.json +1 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/fail23.json +1 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/fail24.json +1 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/fail25.json +1 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/fail27.json +2 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/fail28.json +2 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/fail3.json +1 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/fail4.json +1 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/fail5.json +1 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/fail6.json +1 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/fail7.json +1 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/fail8.json +1 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/fail9.json +1 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/pass1.json +56 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/pass15.json +1 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/pass16.json +1 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/pass17.json +1 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/pass2.json +1 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/pass26.json +1 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/pass3.json +6 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/setup_variant.rb +11 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/test_json.rb +545 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/test_json_addition.rb +196 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/test_json_encoding.rb +65 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/test_json_fixtures.rb +35 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/test_json_generate.rb +322 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/test_json_generic_object.rb +75 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/test_json_string_matching.rb +39 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/test_json_unicode.rb +72 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tools/fuzz.rb +139 -0
- data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tools/server.rb +62 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/LICENSE +1 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/README +1177 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/README.erb +881 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/Rakefile +394 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/TODO +23 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/a.rb +3 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/lib/main.rb +93 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/lib/main/cast.rb +163 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/lib/main/dsl.rb +77 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/lib/main/factories.rb +28 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/lib/main/getoptlong.rb +470 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/lib/main/logger.rb +51 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/lib/main/mode.rb +46 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/lib/main/parameter.rb +735 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/lib/main/program.rb +6 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/lib/main/program/class_methods.rb +381 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/lib/main/program/instance_methods.rb +303 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/lib/main/softspoken.rb +12 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/lib/main/stdext.rb +36 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/lib/main/test.rb +89 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/lib/main/usage.rb +212 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/lib/main/util.rb +109 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/main.gemspec +74 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/samples/a.rb +17 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/samples/b.rb +17 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/samples/c.rb +21 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/samples/d.rb +26 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/samples/e.rb +27 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/samples/f.rb +29 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/samples/g.rb +10 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/samples/h.rb +36 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/samples/j.rb +31 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/test/main_test.rb +954 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/LICENSE +1 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/README +1177 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/README.erb +881 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/Rakefile +394 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/TODO +23 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/a.rb +28 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/lib/main.rb +94 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/lib/main/cast.rb +163 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/lib/main/daemon.rb +525 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/lib/main/dsl.rb +77 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/lib/main/factories.rb +28 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/lib/main/getoptlong.rb +470 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/lib/main/logger.rb +51 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/lib/main/mode.rb +46 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/lib/main/parameter.rb +735 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/lib/main/program.rb +6 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/lib/main/program/class_methods.rb +392 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/lib/main/program/instance_methods.rb +308 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/lib/main/softspoken.rb +12 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/lib/main/stdext.rb +36 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/lib/main/test.rb +89 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/lib/main/usage.rb +212 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/lib/main/util.rb +109 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/main.gemspec +75 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/samples/a.rb +17 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/samples/b.rb +17 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/samples/c.rb +21 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/samples/d.rb +26 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/samples/e.rb +27 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/samples/f.rb +29 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/samples/g.rb +10 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/samples/h.rb +36 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/samples/j.rb +31 -0
- data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/test/main_test.rb +954 -0
- data/vendor/bundle/ruby/1.9.1/gems/map-6.5.5/LICENSE +1 -0
- data/vendor/bundle/ruby/1.9.1/gems/map-6.5.5/README +145 -0
- data/vendor/bundle/ruby/1.9.1/gems/map-6.5.5/Rakefile +394 -0
- data/vendor/bundle/ruby/1.9.1/gems/map-6.5.5/a.rb +22 -0
- data/vendor/bundle/ruby/1.9.1/gems/map-6.5.5/lib/map.rb +1190 -0
- data/vendor/bundle/ruby/1.9.1/gems/map-6.5.5/lib/map/integrations/active_record.rb +140 -0
- data/vendor/bundle/ruby/1.9.1/gems/map-6.5.5/lib/map/options.rb +188 -0
- data/vendor/bundle/ruby/1.9.1/gems/map-6.5.5/lib/map/params.rb +79 -0
- data/vendor/bundle/ruby/1.9.1/gems/map-6.5.5/lib/map/struct.rb +52 -0
- data/vendor/bundle/ruby/1.9.1/gems/map-6.5.5/map.gemspec +46 -0
- data/vendor/bundle/ruby/1.9.1/gems/map-6.5.5/test/leak.rb +61 -0
- data/vendor/bundle/ruby/1.9.1/gems/map-6.5.5/test/lib/testing.rb +74 -0
- data/vendor/bundle/ruby/1.9.1/gems/map-6.5.5/test/map_test.rb +802 -0
- data/vendor/bundle/ruby/1.9.1/gems/method_source-0.8.2/Gemfile +2 -0
- data/vendor/bundle/ruby/1.9.1/gems/method_source-0.8.2/LICENSE +25 -0
- data/vendor/bundle/ruby/1.9.1/gems/method_source-0.8.2/README.markdown +91 -0
- data/vendor/bundle/ruby/1.9.1/gems/method_source-0.8.2/Rakefile +79 -0
- data/vendor/bundle/ruby/1.9.1/gems/method_source-0.8.2/lib/method_source.rb +141 -0
- data/vendor/bundle/ruby/1.9.1/gems/method_source-0.8.2/lib/method_source/code_helpers.rb +154 -0
- data/vendor/bundle/ruby/1.9.1/gems/method_source-0.8.2/lib/method_source/source_location.rb +138 -0
- data/vendor/bundle/ruby/1.9.1/gems/method_source-0.8.2/lib/method_source/version.rb +3 -0
- data/vendor/bundle/ruby/1.9.1/gems/method_source-0.8.2/method_source.gemspec +33 -0
- data/vendor/bundle/ruby/1.9.1/gems/method_source-0.8.2/test/test.rb +138 -0
- data/vendor/bundle/ruby/1.9.1/gems/method_source-0.8.2/test/test_code_helpers.rb +41 -0
- data/vendor/bundle/ruby/1.9.1/gems/method_source-0.8.2/test/test_helper.rb +98 -0
- data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/CHANGELOG.md +220 -0
- data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/CONTRIBUTING.md +46 -0
- data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/Gemfile +29 -0
- data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/LICENSE.md +20 -0
- data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/README.md +119 -0
- data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/Rakefile +25 -0
- data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/lib/multi_json.rb +158 -0
- data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/lib/multi_json/adapter.rb +37 -0
- data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/lib/multi_json/adapter_error.rb +15 -0
- data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/lib/multi_json/adapters/gson.rb +21 -0
- data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/lib/multi_json/adapters/jr_jackson.rb +19 -0
- data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/lib/multi_json/adapters/json_common.rb +25 -0
- data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/lib/multi_json/adapters/json_gem.rb +11 -0
- data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/lib/multi_json/adapters/json_pure.rb +11 -0
- data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/lib/multi_json/adapters/nsjsonserialization.rb +34 -0
- data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/lib/multi_json/adapters/oj.rb +25 -0
- data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/lib/multi_json/adapters/ok_json.rb +24 -0
- data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/lib/multi_json/adapters/yajl.rb +19 -0
- data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/lib/multi_json/convertible_hash_keys.rb +43 -0
- data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/lib/multi_json/options.rb +38 -0
- data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/lib/multi_json/parse_error.rb +17 -0
- data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/lib/multi_json/vendor/okjson.rb +606 -0
- data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/lib/multi_json/version.rb +20 -0
- data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/multi_json.gemspec +22 -0
- data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/spec/gson_adapter_spec.rb +10 -0
- data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/spec/jr_jackson_adapter_spec.rb +10 -0
- data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/spec/json_gem_adapter_spec.rb +9 -0
- data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/spec/json_pure_adapter_spec.rb +9 -0
- data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/spec/multi_json_spec.rb +200 -0
- data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/spec/nsjsonserialization_adapter_spec.rb +10 -0
- data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/spec/oj_adapter_spec.rb +20 -0
- data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/spec/ok_json_adapter_spec.rb +7 -0
- data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/spec/shared/adapter.rb +236 -0
- data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/spec/shared/json_common_adapter.rb +30 -0
- data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/spec/shared/options.rb +119 -0
- data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/spec/spec_helper.rb +77 -0
- data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/spec/yajl_adapter_spec.rb +10 -0
- data/vendor/bundle/ruby/1.9.1/gems/multi_xml-0.5.5/CHANGELOG.md +93 -0
- data/vendor/bundle/ruby/1.9.1/gems/multi_xml-0.5.5/CONTRIBUTING.md +49 -0
- data/vendor/bundle/ruby/1.9.1/gems/multi_xml-0.5.5/LICENSE.md +20 -0
- data/vendor/bundle/ruby/1.9.1/gems/multi_xml-0.5.5/README.md +97 -0
- data/vendor/bundle/ruby/1.9.1/gems/multi_xml-0.5.5/Rakefile +21 -0
- data/vendor/bundle/ruby/1.9.1/gems/multi_xml-0.5.5/lib/multi_xml.rb +296 -0
- data/vendor/bundle/ruby/1.9.1/gems/multi_xml-0.5.5/lib/multi_xml/parsers/libxml.rb +30 -0
- data/vendor/bundle/ruby/1.9.1/gems/multi_xml-0.5.5/lib/multi_xml/parsers/libxml2_parser.rb +74 -0
- data/vendor/bundle/ruby/1.9.1/gems/multi_xml-0.5.5/lib/multi_xml/parsers/nokogiri.rb +32 -0
- data/vendor/bundle/ruby/1.9.1/gems/multi_xml-0.5.5/lib/multi_xml/parsers/ox.rb +97 -0
- data/vendor/bundle/ruby/1.9.1/gems/multi_xml-0.5.5/lib/multi_xml/parsers/rexml.rb +113 -0
- data/vendor/bundle/ruby/1.9.1/gems/multi_xml-0.5.5/lib/multi_xml/version.rb +3 -0
- data/vendor/bundle/ruby/1.9.1/gems/multi_xml-0.5.5/multi_xml.gemspec +24 -0
- data/vendor/bundle/ruby/1.9.1/gems/multi_xml-0.5.5/spec/helper.rb +17 -0
- data/vendor/bundle/ruby/1.9.1/gems/multi_xml-0.5.5/spec/multi_xml_spec.rb +43 -0
- data/vendor/bundle/ruby/1.9.1/gems/multi_xml-0.5.5/spec/parser_shared_example.rb +694 -0
- data/vendor/bundle/ruby/1.9.1/gems/multi_xml-0.5.5/spec/speed.rb +63 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/CHANGELOG +534 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/CONTRIBUTORS +55 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/Gemfile +12 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/LICENSE +25 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/README.markdown +400 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/Rakefile +140 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/TODO +117 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/bin/pry +16 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry.rb +274 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/cli.rb +202 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/code.rb +385 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/code/code_range.rb +70 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/code/loc.rb +92 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/code_object.rb +153 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/command.rb +689 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/command_set.rb +400 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands.rb +6 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/amend_line.rb +99 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/bang.rb +20 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/bang_pry.rb +17 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/cat.rb +53 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/cat/abstract_formatter.rb +27 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/cat/exception_formatter.rb +78 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/cat/file_formatter.rb +84 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/cat/input_expression_formatter.rb +43 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/cd.rb +30 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/code_collector.rb +165 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/disable_pry.rb +27 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/disabled_commands.rb +2 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/easter_eggs.rb +112 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/edit.rb +207 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/edit/exception_patcher.rb +25 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/edit/file_and_line_locator.rb +38 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/edit/method_patcher.rb +122 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/exit.rb +42 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/exit_all.rb +29 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/exit_program.rb +24 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/find_method.rb +199 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/fix_indent.rb +19 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/gem_cd.rb +26 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/gem_install.rb +29 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/gem_list.rb +33 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/gem_open.rb +29 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/gist.rb +102 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/help.rb +164 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/hist.rb +161 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/import_set.rb +22 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/install_command.rb +51 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/jump_to.rb +29 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/ls.rb +338 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/nesting.rb +25 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/play.rb +69 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/pry_backtrace.rb +26 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/pry_version.rb +17 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/raise_up.rb +32 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/reload_code.rb +65 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/reset.rb +18 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/ri.rb +56 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/save_file.rb +61 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/shell_command.rb +43 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/shell_mode.rb +27 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/show_doc.rb +78 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/show_info.rb +200 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/show_input.rb +17 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/show_source.rb +38 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/simple_prompt.rb +22 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/stat.rb +40 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/switch_to.rb +23 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/toggle_color.rb +20 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/whereami.rb +182 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/wtf.rb +57 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/completion.rb +321 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/config.rb +258 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/core_extensions.rb +121 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/custom_completions.rb +6 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/editor.rb +129 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/helpers.rb +5 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/helpers/base_helpers.rb +200 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/helpers/command_helpers.rb +154 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/helpers/documentation_helpers.rb +76 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/helpers/options_helpers.rb +27 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/helpers/table.rb +109 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/helpers/text.rb +108 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/history.rb +124 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/history_array.rb +116 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/hooks.rb +250 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/indent.rb +406 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/method.rb +551 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/method/disowned.rb +53 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/method/weird_method_locator.rb +186 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/module_candidate.rb +146 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/pager.rb +90 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/plugins.rb +103 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/pry_class.rb +456 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/pry_instance.rb +765 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/rbx_method.rb +13 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/rbx_path.rb +22 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/repl_file_loader.rb +80 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/rubygem.rb +74 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/terminal.rb +78 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/test/helper.rb +185 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/version.rb +3 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/wrapped_module.rb +387 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/man/pry.1 +195 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/man/pry.1.html +204 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/man/pry.1.ronn +141 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/pry.gemspec +29 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/Procfile +3 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/cli_spec.rb +78 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/code_object_spec.rb +277 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/code_spec.rb +219 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/command_helpers_spec.rb +29 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/command_integration_spec.rb +644 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/command_set_spec.rb +627 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/command_spec.rb +821 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/commands/amend_line_spec.rb +247 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/commands/bang_spec.rb +19 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/commands/cat_spec.rb +164 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/commands/cd_spec.rb +250 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/commands/disable_pry_spec.rb +25 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/commands/edit_spec.rb +727 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/commands/exit_all_spec.rb +34 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/commands/exit_program_spec.rb +19 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/commands/exit_spec.rb +34 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/commands/find_method_spec.rb +70 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/commands/gem_list_spec.rb +26 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/commands/gist_spec.rb +79 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/commands/help_spec.rb +56 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/commands/hist_spec.rb +181 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/commands/jump_to_spec.rb +15 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/commands/ls_spec.rb +181 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/commands/play_spec.rb +140 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/commands/raise_up_spec.rb +56 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/commands/save_file_spec.rb +177 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/commands/show_doc_spec.rb +510 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/commands/show_input_spec.rb +17 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/commands/show_source_spec.rb +782 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/commands/whereami_spec.rb +203 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/completion_spec.rb +241 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/control_d_handler_spec.rb +58 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/documentation_helper_spec.rb +73 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/editor_spec.rb +79 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/exception_whitelist_spec.rb +21 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/fixtures/candidate_helper1.rb +11 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/fixtures/candidate_helper2.rb +8 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/fixtures/example.erb +5 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/fixtures/example_nesting.rb +33 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/fixtures/show_source_doc_examples.rb +15 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/fixtures/testrc +2 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/fixtures/testrcbad +2 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/fixtures/whereami_helper.rb +6 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/helper.rb +34 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/helpers/bacon.rb +86 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/helpers/mock_pry.rb +43 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/helpers/table_spec.rb +105 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/history_array_spec.rb +67 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/hooks_spec.rb +522 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/indent_spec.rb +301 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/input_stack_spec.rb +90 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/method_spec.rb +482 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/prompt_spec.rb +60 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/pry_defaults_spec.rb +419 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/pry_history_spec.rb +99 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/pry_output_spec.rb +95 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/pry_spec.rb +515 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/run_command_spec.rb +25 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/sticky_locals_spec.rb +157 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/syntax_checking_spec.rb +81 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/wrapped_module_spec.rb +261 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/wiki/Customizing-pry.md +397 -0
- data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/wiki/Home.md +4 -0
- data/vendor/bundle/ruby/1.9.1/gems/sekrets-1.7.0/README +144 -0
- data/vendor/bundle/ruby/1.9.1/gems/sekrets-1.7.0/Rakefile +390 -0
- data/vendor/bundle/ruby/1.9.1/gems/sekrets-1.7.0/bin/sekrets +372 -0
- data/vendor/bundle/ruby/1.9.1/gems/sekrets-1.7.0/lib/sekrets.rb +511 -0
- data/vendor/bundle/ruby/1.9.1/gems/sekrets-1.7.0/lib/sekrets/capistrano.rb +37 -0
- data/vendor/bundle/ruby/1.9.1/gems/sekrets-1.7.0/sekrets.gemspec +50 -0
- data/vendor/bundle/ruby/1.9.1/gems/sekrets-1.7.0/test/lib/testing.rb +75 -0
- data/vendor/bundle/ruby/1.9.1/gems/sekrets-1.7.0/test/sekrets_test.rb +167 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/CHANGELOG +5790 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/MIT-LICENSE +19 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/README.rdoc +815 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/Rakefile +186 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/bin/sequel +244 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/active_record.rdoc +912 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/advanced_associations.rdoc +818 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/association_basics.rdoc +1763 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/bin_sequel.rdoc +144 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/cheat_sheet.rdoc +220 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/code_order.rdoc +96 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/core_extensions.rdoc +364 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/dataset_basics.rdoc +105 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/dataset_filtering.rdoc +191 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/extensions.rdoc +84 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/mass_assignment.rdoc +55 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/migration.rdoc +611 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/model_hooks.rdoc +262 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/model_plugins.rdoc +270 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/mssql_stored_procedures.rdoc +43 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/object_model.rdoc +573 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/opening_databases.rdoc +489 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/postgresql.rdoc +326 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/prepared_statements.rdoc +139 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/querying.rdoc +1017 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/reflection.rdoc +121 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/1.0.txt +38 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/1.1.txt +143 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/1.3.txt +101 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/1.4.0.txt +53 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/1.5.0.txt +155 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/2.0.0.txt +298 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/2.1.0.txt +271 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/2.10.0.txt +328 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/2.11.0.txt +215 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/2.12.0.txt +534 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/2.2.0.txt +253 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/2.3.0.txt +88 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/2.4.0.txt +106 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/2.5.0.txt +137 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/2.6.0.txt +157 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/2.7.0.txt +166 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/2.8.0.txt +171 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/2.9.0.txt +97 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.0.0.txt +221 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.1.0.txt +406 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.10.0.txt +286 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.11.0.txt +254 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.12.0.txt +304 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.13.0.txt +210 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.14.0.txt +118 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.15.0.txt +78 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.16.0.txt +45 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.17.0.txt +58 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.18.0.txt +120 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.19.0.txt +67 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.2.0.txt +268 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.20.0.txt +41 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.21.0.txt +87 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.22.0.txt +39 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.23.0.txt +172 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.24.0.txt +420 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.25.0.txt +88 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.26.0.txt +88 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.27.0.txt +82 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.28.0.txt +304 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.29.0.txt +459 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.3.0.txt +192 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.30.0.txt +135 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.31.0.txt +146 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.32.0.txt +202 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.33.0.txt +157 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.34.0.txt +671 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.35.0.txt +144 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.36.0.txt +245 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.37.0.txt +338 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.38.0.txt +234 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.39.0.txt +237 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.4.0.txt +325 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.40.0.txt +73 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.41.0.txt +155 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.42.0.txt +74 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.43.0.txt +105 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.44.0.txt +152 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.45.0.txt +179 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.46.0.txt +122 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.47.0.txt +270 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.48.0.txt +477 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.5.0.txt +510 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.6.0.txt +366 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.7.0.txt +179 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.8.0.txt +151 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.9.0.txt +233 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/4.0.0.txt +262 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/4.1.0.txt +85 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/4.10.0.txt +226 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/4.11.0.txt +147 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/4.12.0.txt +105 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/4.13.0.txt +169 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/4.14.0.txt +68 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/4.15.0.txt +56 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/4.2.0.txt +129 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/4.3.0.txt +40 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/4.4.0.txt +92 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/4.5.0.txt +34 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/4.6.0.txt +30 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/4.7.0.txt +103 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/4.8.0.txt +175 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/4.9.0.txt +190 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/schema_modification.rdoc +654 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/security.rdoc +370 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/sharding.rdoc +245 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/sql.rdoc +589 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/testing.rdoc +176 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/thread_safety.rdoc +17 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/transactions.rdoc +168 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/validations.rdoc +540 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/virtual_rows.rdoc +272 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel.rb +1 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/ado.rb +151 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/ado/access.rb +335 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/ado/mssql.rb +69 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/amalgalite.rb +179 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/cubrid.rb +143 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/db2.rb +229 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/dbi.rb +101 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/do.rb +156 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/do/mysql.rb +64 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/do/postgres.rb +42 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/do/sqlite3.rb +40 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/fdbsql.rb +285 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/firebird.rb +104 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/ibmdb.rb +476 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/informix.rb +67 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/jdbc.rb +794 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/jdbc/as400.rb +82 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/jdbc/cubrid.rb +62 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/jdbc/db2.rb +91 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/jdbc/derby.rb +312 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/jdbc/fdbsql.rb +65 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/jdbc/firebirdsql.rb +34 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/jdbc/h2.rb +227 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/jdbc/hsqldb.rb +231 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/jdbc/informix-sqli.rb +31 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/jdbc/jdbcprogress.rb +31 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/jdbc/jtds.rb +45 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/jdbc/mssql.rb +47 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/jdbc/mysql.rb +90 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/jdbc/oracle.rb +140 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/jdbc/postgresql.rb +215 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/jdbc/sqlanywhere.rb +82 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/jdbc/sqlite.rb +82 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/jdbc/sqlserver.rb +61 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/jdbc/transactions.rb +109 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/mock.rb +391 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/mysql.rb +372 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/mysql2.rb +200 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/odbc.rb +149 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/odbc/db2.rb +9 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/odbc/mssql.rb +61 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/odbc/progress.rb +8 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/openbase.rb +53 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/oracle.rb +459 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/postgres.rb +877 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/shared/access.rb +299 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/shared/cubrid.rb +243 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/shared/db2.rb +403 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/shared/fdbsql.rb +550 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/shared/firebird.rb +245 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/shared/informix.rb +52 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/shared/mssql.rb +1037 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/shared/mysql.rb +984 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/shared/mysql_prepared_statements.rb +182 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/shared/oracle.rb +522 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/shared/postgres.rb +1617 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/shared/progress.rb +38 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/shared/sqlanywhere.rb +470 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/shared/sqlite.rb +729 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/sqlanywhere.rb +177 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/sqlite.rb +413 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/swift.rb +150 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/swift/mysql.rb +47 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/swift/postgres.rb +45 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/swift/sqlite.rb +35 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/tinytds.rb +282 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/utils/emulate_offset_with_reverse_and_count.rb +75 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/utils/emulate_offset_with_row_number.rb +62 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/utils/pg_types.rb +68 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/utils/replace.rb +36 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/utils/split_alter_table.rb +44 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/utils/stored_procedures.rb +74 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/ast_transformer.rb +200 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/connection_pool.rb +110 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/connection_pool/sharded_single.rb +98 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/connection_pool/sharded_threaded.rb +265 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/connection_pool/single.rb +38 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/connection_pool/threaded.rb +198 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/core.rb +394 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/database.rb +20 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/database/connecting.rb +318 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/database/dataset.rb +69 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/database/dataset_defaults.rb +175 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/database/features.rb +134 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/database/logging.rb +73 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/database/misc.rb +534 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/database/query.rb +329 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/database/schema_generator.rb +525 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/database/schema_methods.rb +964 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/database/transactions.rb +353 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/dataset.rb +40 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/dataset/actions.rb +1045 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/dataset/features.rb +203 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/dataset/graph.rb +272 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/dataset/misc.rb +279 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/dataset/mutation.rb +109 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/dataset/placeholder_literalizer.rb +179 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/dataset/prepared_statements.rb +283 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/dataset/query.rb +1136 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/dataset/sql.rb +1555 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/deprecated.rb +58 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/exceptions.rb +77 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/_pretty_table.rb +84 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/arbitrary_servers.rb +110 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/blank.rb +47 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/columns_introspection.rb +83 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/connection_validator.rb +110 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/constraint_validations.rb +455 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/core_extensions.rb +230 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/core_refinements.rb +221 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/current_datetime_timestamp.rb +58 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/dataset_source_alias.rb +91 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/date_arithmetic.rb +192 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/empty_array_ignore_nulls.rb +34 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/error_sql.rb +72 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/eval_inspect.rb +182 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/filter_having.rb +59 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/from_block.rb +32 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/graph_each.rb +75 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/hash_aliases.rb +45 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/inflector.rb +246 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/looser_typecasting.rb +44 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/meta_def.rb +31 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/migration.rb +736 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/mssql_emulate_lateral_with_apply.rb +80 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/named_timezones.rb +99 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/null_dataset.rb +105 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/pagination.rb +121 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/pg_array.rb +606 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/pg_array_ops.rb +324 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/pg_enum.rb +136 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/pg_hstore.rb +357 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/pg_hstore_ops.rb +349 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/pg_inet.rb +118 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/pg_interval.rb +198 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/pg_json.rb +365 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/pg_json_ops.rb +434 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/pg_loose_count.rb +33 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/pg_range.rb +546 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/pg_range_ops.rb +162 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/pg_row.rb +615 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/pg_row_ops.rb +194 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/pg_static_cache_updater.rb +140 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/pretty_table.rb +36 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/query.rb +78 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/query_literals.rb +80 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/round_timestamps.rb +52 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/ruby18_symbol_extensions.rb +22 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/schema_caching.rb +75 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/schema_dumper.rb +476 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/select_remove.rb +48 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/sequel_3_dataset_methods.rb +118 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/server_block.rb +149 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/set_overrides.rb +72 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/split_array_nil.rb +66 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/sql_expr.rb +20 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/string_date_time.rb +50 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/thread_local_timezones.rb +55 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/to_dot.rb +154 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/model.rb +175 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/model/associations.rb +3171 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/model/base.rb +2306 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/model/dataset_module.rb +30 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/model/default_inflections.rb +45 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/model/errors.rb +58 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/model/exceptions.rb +46 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/model/inflections.rb +162 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/model/plugins.rb +49 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/no_core_ext.rb +1 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/active_model.rb +99 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/after_initialize.rb +37 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/association_autoreloading.rb +7 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/association_dependencies.rb +97 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/association_pks.rb +167 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/association_proxies.rb +105 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/auto_validations.rb +161 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/blacklist_security.rb +93 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/boolean_readers.rb +56 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/caching.rb +153 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/class_table_inheritance.rb +292 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/column_select.rb +57 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/composition.rb +187 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/constraint_validations.rb +229 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/dataset_associations.rb +107 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/defaults_setter.rb +69 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/dirty.rb +231 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/eager_each.rb +64 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/error_splitter.rb +54 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/force_encoding.rb +81 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/hook_class_methods.rb +125 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/input_transformer.rb +79 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/insert_returning_select.rb +70 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/instance_filters.rb +131 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/instance_hooks.rb +96 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/json_serializer.rb +352 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/lazy_attributes.rb +117 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/list.rb +189 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/many_through_many.rb +317 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/many_to_one_pk_lookup.rb +7 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/modification_detection.rb +90 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/mssql_optimistic_locking.rb +92 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/nested_attributes.rb +323 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/optimistic_locking.rb +83 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/pg_array_associations.rb +528 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/pg_row.rb +123 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/pg_typecast_on_load.rb +78 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/prepared_statements.rb +205 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/prepared_statements_associations.rb +116 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/prepared_statements_safe.rb +73 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/prepared_statements_with_pk.rb +59 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/rcte_tree.rb +343 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/schema.rb +80 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/scissors.rb +33 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/serialization.rb +235 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/serialization_modification_detection.rb +84 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/sharding.rb +117 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/single_table_inheritance.rb +230 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/skip_create_refresh.rb +35 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/split_values.rb +64 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/static_cache.rb +215 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/string_stripper.rb +57 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/subclasses.rb +61 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/table_select.rb +41 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/tactical_eager_loading.rb +85 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/timestamps.rb +95 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/touch.rb +140 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/tree.rb +156 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/typecast_on_load.rb +80 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/unlimited_update.rb +31 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/update_or_create.rb +60 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/update_primary_key.rb +70 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/validation_class_methods.rb +439 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/validation_helpers.rb +291 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/xml_serializer.rb +410 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/sql.rb +1865 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/timezones.rb +221 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/version.rb +18 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/adapters/db2_spec.rb +148 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/adapters/fdbsql_spec.rb +429 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/adapters/firebird_spec.rb +417 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/adapters/informix_spec.rb +100 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/adapters/mssql_spec.rb +722 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/adapters/mysql_spec.rb +1304 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/adapters/oracle_spec.rb +315 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/adapters/postgres_spec.rb +3537 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/adapters/spec_helper.rb +76 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/adapters/sqlanywhere_spec.rb +170 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/adapters/sqlite_spec.rb +650 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/bin_spec.rb +256 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/core/connection_pool_spec.rb +982 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/core/database_spec.rb +2487 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/core/dataset_spec.rb +4970 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/core/deprecated_spec.rb +70 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/core/expression_filters_spec.rb +1197 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/core/mock_adapter_spec.rb +462 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/core/object_graph_spec.rb +303 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/core/placeholder_literalizer_spec.rb +163 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/core/schema_generator_spec.rb +179 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/core/schema_spec.rb +1610 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/core/spec_helper.rb +49 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/core/version_spec.rb +7 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/core_extensions_spec.rb +695 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/active_model_spec.rb +123 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/after_initialize_spec.rb +24 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/arbitrary_servers_spec.rb +109 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/association_dependencies_spec.rb +117 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/association_pks_spec.rb +281 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/association_proxies_spec.rb +86 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/auto_validations_spec.rb +158 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/blacklist_security_spec.rb +87 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/blank_spec.rb +69 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/boolean_readers_spec.rb +93 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/caching_spec.rb +270 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/class_table_inheritance_spec.rb +274 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/column_select_spec.rb +108 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/columns_introspection_spec.rb +91 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/composition_spec.rb +242 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/connection_validator_spec.rb +118 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/constraint_validations_plugin_spec.rb +274 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/constraint_validations_spec.rb +325 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/core_refinements_spec.rb +519 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/current_datetime_timestamp_spec.rb +27 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/dataset_associations_spec.rb +311 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/dataset_source_alias_spec.rb +51 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/date_arithmetic_spec.rb +157 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/defaults_setter_spec.rb +101 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/dirty_spec.rb +180 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/eager_each_spec.rb +42 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/empty_array_ignore_nulls_spec.rb +24 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/error_splitter_spec.rb +18 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/error_sql_spec.rb +20 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/eval_inspect_spec.rb +73 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/filter_having_spec.rb +40 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/force_encoding_spec.rb +114 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/from_block_spec.rb +21 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/graph_each_spec.rb +109 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/hash_aliases_spec.rb +24 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/hook_class_methods_spec.rb +416 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/inflector_spec.rb +183 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/input_transformer_spec.rb +54 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/insert_returning_select_spec.rb +46 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/instance_filters_spec.rb +79 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/instance_hooks_spec.rb +276 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/json_serializer_spec.rb +267 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/lazy_attributes_spec.rb +170 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/list_spec.rb +265 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/looser_typecasting_spec.rb +43 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/many_through_many_spec.rb +2159 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/meta_def_spec.rb +21 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/migration_spec.rb +709 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/modification_detection_spec.rb +80 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/mssql_optimistic_locking_spec.rb +91 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/named_timezones_spec.rb +108 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/nested_attributes_spec.rb +697 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/null_dataset_spec.rb +85 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/optimistic_locking_spec.rb +128 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/pagination_spec.rb +118 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/pg_array_associations_spec.rb +736 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/pg_array_ops_spec.rb +143 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/pg_array_spec.rb +390 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/pg_enum_spec.rb +64 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/pg_hstore_ops_spec.rb +236 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/pg_hstore_spec.rb +206 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/pg_inet_spec.rb +52 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/pg_interval_spec.rb +76 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/pg_json_ops_spec.rb +226 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/pg_json_spec.rb +218 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/pg_loose_count_spec.rb +17 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/pg_range_ops_spec.rb +58 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/pg_range_spec.rb +404 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/pg_row_ops_spec.rb +60 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/pg_row_plugin_spec.rb +62 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/pg_row_spec.rb +360 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/pg_static_cache_updater_spec.rb +92 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/pg_typecast_on_load_spec.rb +63 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/prepared_statements_associations_spec.rb +151 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/prepared_statements_safe_spec.rb +61 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/prepared_statements_spec.rb +103 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/prepared_statements_with_pk_spec.rb +31 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/pretty_table_spec.rb +92 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/query_literals_spec.rb +167 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/query_spec.rb +102 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/rcte_tree_spec.rb +387 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/round_timestamps_spec.rb +43 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/schema_caching_spec.rb +41 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/schema_dumper_spec.rb +788 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/schema_spec.rb +113 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/scissors_spec.rb +26 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/select_remove_spec.rb +38 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/sequel_3_dataset_methods_spec.rb +101 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/serialization_modification_detection_spec.rb +98 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/serialization_spec.rb +340 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/server_block_spec.rb +90 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/set_overrides_spec.rb +61 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/sharding_spec.rb +198 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/shared_caching_spec.rb +175 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/single_table_inheritance_spec.rb +276 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/skip_create_refresh_spec.rb +17 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/spec_helper.rb +96 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/split_array_nil_spec.rb +24 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/split_values_spec.rb +22 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/sql_expr_spec.rb +60 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/static_cache_spec.rb +355 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/string_date_time_spec.rb +95 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/string_stripper_spec.rb +68 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/subclasses_spec.rb +66 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/table_select_spec.rb +71 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/tactical_eager_loading_spec.rb +82 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/thread_local_timezones_spec.rb +67 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/timestamps_spec.rb +175 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/to_dot_spec.rb +154 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/touch_spec.rb +203 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/tree_spec.rb +270 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/typecast_on_load_spec.rb +80 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/unlimited_update_spec.rb +20 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/update_or_create_spec.rb +81 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/update_primary_key_spec.rb +100 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/validation_class_methods_spec.rb +1030 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/validation_helpers_spec.rb +520 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/xml_serializer_spec.rb +207 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/bad_down_migration/001_create_alt_basic.rb +4 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/bad_down_migration/002_create_alt_advanced.rb +4 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/bad_timestamped_migrations/1273253849_create_sessions.rb +9 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/bad_timestamped_migrations/1273253851_create_nodes.rb +9 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/bad_timestamped_migrations/1273253853_3_create_users.rb +3 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/bad_up_migration/001_create_alt_basic.rb +4 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/bad_up_migration/002_create_alt_advanced.rb +3 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/convert_to_timestamp_migrations/001_create_sessions.rb +9 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/convert_to_timestamp_migrations/002_create_nodes.rb +9 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/convert_to_timestamp_migrations/003_3_create_users.rb +4 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/convert_to_timestamp_migrations/1273253850_create_artists.rb +9 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/convert_to_timestamp_migrations/1273253852_create_albums.rb +9 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/duplicate_integer_migrations/001_create_alt_advanced.rb +4 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/duplicate_integer_migrations/001_create_alt_basic.rb +4 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/duplicate_timestamped_migrations/1273253849_create_sessions.rb +9 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/duplicate_timestamped_migrations/1273253853_create_nodes.rb +9 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/duplicate_timestamped_migrations/1273253853_create_users.rb +4 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/integer_migrations/001_create_sessions.rb +9 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/integer_migrations/002_create_nodes.rb +9 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/integer_migrations/003_3_create_users.rb +4 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/interleaved_timestamped_migrations/1273253849_create_sessions.rb +9 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/interleaved_timestamped_migrations/1273253850_create_artists.rb +9 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/interleaved_timestamped_migrations/1273253851_create_nodes.rb +9 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/interleaved_timestamped_migrations/1273253852_create_albums.rb +9 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/interleaved_timestamped_migrations/1273253853_3_create_users.rb +4 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/missing_integer_migrations/001_create_alt_basic.rb +4 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/missing_integer_migrations/003_create_alt_advanced.rb +4 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/missing_timestamped_migrations/1273253849_create_sessions.rb +9 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/missing_timestamped_migrations/1273253853_3_create_users.rb +4 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/reversible_migrations/001_reversible.rb +5 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/reversible_migrations/002_reversible.rb +5 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/reversible_migrations/003_reversible.rb +5 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/reversible_migrations/004_reversible.rb +5 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/reversible_migrations/005_reversible.rb +10 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/timestamped_migrations/1273253849_create_sessions.rb +9 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/timestamped_migrations/1273253851_create_nodes.rb +9 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/timestamped_migrations/1273253853_3_create_users.rb +4 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/transaction_specified_migrations/001_create_alt_basic.rb +4 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/transaction_specified_migrations/002_create_basic.rb +4 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/transaction_unspecified_migrations/001_create_alt_basic.rb +3 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/transaction_unspecified_migrations/002_create_basic.rb +3 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/uppercase_timestamped_migrations/1273253849_CREATE_SESSIONS.RB +9 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/uppercase_timestamped_migrations/1273253851_CREATE_NODES.RB +9 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/uppercase_timestamped_migrations/1273253853_3_CREATE_USERS.RB +4 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/integration/associations_test.rb +2453 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/integration/database_test.rb +113 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/integration/dataset_test.rb +1798 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/integration/eager_loader_test.rb +687 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/integration/migrator_test.rb +240 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/integration/model_test.rb +226 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/integration/plugin_test.rb +2162 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/integration/prepared_statement_test.rb +426 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/integration/schema_test.rb +801 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/integration/spec_helper.rb +111 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/integration/timezone_test.rb +86 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/integration/transaction_test.rb +374 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/integration/type_test.rb +133 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/model/association_reflection_spec.rb +500 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/model/associations_spec.rb +4316 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/model/base_spec.rb +746 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/model/class_dataset_methods_spec.rb +145 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/model/dataset_methods_spec.rb +149 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/model/eager_loading_spec.rb +2080 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/model/hooks_spec.rb +536 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/model/inflector_spec.rb +26 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/model/model_spec.rb +992 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/model/plugins_spec.rb +299 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/model/record_spec.rb +2053 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/model/spec_helper.rb +64 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/model/validations_spec.rb +191 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/rspec_helper.rb +22 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/sequel_coverage.rb +15 -0
- data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/spec_config.rb +2 -0
- data/vendor/bundle/ruby/1.9.1/gems/slop-3.5.0/CHANGES.md +303 -0
- data/vendor/bundle/ruby/1.9.1/gems/slop-3.5.0/Gemfile +3 -0
- data/vendor/bundle/ruby/1.9.1/gems/slop-3.5.0/LICENSE +20 -0
- data/vendor/bundle/ruby/1.9.1/gems/slop-3.5.0/README.md +182 -0
- data/vendor/bundle/ruby/1.9.1/gems/slop-3.5.0/Rakefile +29 -0
- data/vendor/bundle/ruby/1.9.1/gems/slop-3.5.0/lib/slop.rb +687 -0
- data/vendor/bundle/ruby/1.9.1/gems/slop-3.5.0/lib/slop/commands.rb +196 -0
- data/vendor/bundle/ruby/1.9.1/gems/slop-3.5.0/lib/slop/option.rb +209 -0
- data/vendor/bundle/ruby/1.9.1/gems/slop-3.5.0/slop.gemspec +17 -0
- data/vendor/bundle/ruby/1.9.1/gems/slop-3.5.0/test/commands_test.rb +26 -0
- data/vendor/bundle/ruby/1.9.1/gems/slop-3.5.0/test/helper.rb +12 -0
- data/vendor/bundle/ruby/1.9.1/gems/slop-3.5.0/test/option_test.rb +138 -0
- data/vendor/bundle/ruby/1.9.1/gems/slop-3.5.0/test/slop_test.rb +518 -0
- data/vendor/bundle/ruby/1.9.1/gems/threadify-1.3.0/README +151 -0
- data/vendor/bundle/ruby/1.9.1/gems/threadify-1.3.0/README.erb +43 -0
- data/vendor/bundle/ruby/1.9.1/gems/threadify-1.3.0/lib/threadify.rb +176 -0
- data/vendor/bundle/ruby/1.9.1/gems/threadify-1.3.0/rakefile +222 -0
- data/vendor/bundle/ruby/1.9.1/gems/threadify-1.3.0/sample/a.rb +37 -0
- data/vendor/bundle/ruby/1.9.1/gems/threadify-1.3.0/sample/b.rb +41 -0
- data/vendor/bundle/ruby/1.9.1/gems/threadify-1.3.0/threadify.gemspec +26 -0
- data/vendor/bundle/ruby/1.9.1/specifications/amalgalite-1.3.0.gemspec +52 -0
- data/vendor/bundle/ruby/1.9.1/specifications/arrayfields-4.7.4.gemspec +16 -0
- data/vendor/bundle/ruby/1.9.1/specifications/chronic-0.10.2.gemspec +42 -0
- data/vendor/bundle/ruby/1.9.1/specifications/coderay-1.1.0.gemspec +23 -0
- data/vendor/bundle/ruby/1.9.1/specifications/coerce-0.0.6.gemspec +30 -0
- data/vendor/bundle/ruby/1.9.1/specifications/daemons-1.1.9.gemspec +19 -0
- data/vendor/bundle/ruby/1.9.1/specifications/fastercsv-1.5.5.gemspec +20 -0
- data/vendor/bundle/ruby/1.9.1/specifications/fattr-2.2.2.gemspec +18 -0
- data/vendor/bundle/ruby/1.9.1/specifications/flowdock-0.5.0.gemspec +51 -0
- data/vendor/bundle/ruby/1.9.1/specifications/highline-1.6.21.gemspec +21 -0
- data/vendor/bundle/ruby/1.9.1/specifications/httparty-0.13.1.gemspec +35 -0
- data/vendor/bundle/ruby/1.9.1/specifications/json-1.8.1.gemspec +36 -0
- data/vendor/bundle/ruby/1.9.1/specifications/main-6.0.0.gemspec +39 -0
- data/vendor/bundle/ruby/1.9.1/specifications/main-6.1.0.gemspec +39 -0
- data/vendor/bundle/ruby/1.9.1/specifications/map-6.5.5.gemspec +18 -0
- data/vendor/bundle/ruby/1.9.1/specifications/method_source-0.8.2.gemspec +31 -0
- data/vendor/bundle/ruby/1.9.1/specifications/multi_json-1.10.1.gemspec +30 -0
- data/vendor/bundle/ruby/1.9.1/specifications/multi_xml-0.5.5.gemspec +30 -0
- data/vendor/bundle/ruby/1.9.1/specifications/pry-0.9.12.6.gemspec +51 -0
- data/vendor/bundle/ruby/1.9.1/specifications/sekrets-1.7.0.gemspec +43 -0
- data/vendor/bundle/ruby/1.9.1/specifications/sequel-4.15.0.gemspec +22 -0
- data/vendor/bundle/ruby/1.9.1/specifications/slop-3.5.0.gemspec +33 -0
- data/vendor/bundle/ruby/1.9.1/specifications/threadify-1.3.0.gemspec +16 -0
- metadata +1804 -0
@@ -0,0 +1,3171 @@
|
|
1
|
+
module Sequel
|
2
|
+
class Model
|
3
|
+
# Associations are used in order to specify relationships between model classes
|
4
|
+
# that reflect relations between tables in the database using foreign keys.
|
5
|
+
module Associations
|
6
|
+
# Map of association type symbols to association reflection classes.
|
7
|
+
ASSOCIATION_TYPES = {}
|
8
|
+
|
9
|
+
# Set an empty association reflection hash in the model
|
10
|
+
def self.apply(model)
|
11
|
+
model.instance_eval do
|
12
|
+
@association_reflections = {}
|
13
|
+
@autoreloading_associations = {}
|
14
|
+
@cache_associations = true
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
# AssociationReflection is a Hash subclass that keeps information on Sequel::Model associations. It
|
19
|
+
# provides methods to reduce internal code duplication. It should not
|
20
|
+
# be instantiated by the user.
|
21
|
+
class AssociationReflection < Hash
|
22
|
+
include Sequel::Inflections
|
23
|
+
|
24
|
+
# Name symbol for the _add internal association method
|
25
|
+
def _add_method
|
26
|
+
:"_add_#{singularize(self[:name])}"
|
27
|
+
end
|
28
|
+
|
29
|
+
# Name symbol for the _remove_all internal association method
|
30
|
+
def _remove_all_method
|
31
|
+
:"_remove_all_#{self[:name]}"
|
32
|
+
end
|
33
|
+
|
34
|
+
# Name symbol for the _remove internal association method
|
35
|
+
def _remove_method
|
36
|
+
:"_remove_#{singularize(self[:name])}"
|
37
|
+
end
|
38
|
+
|
39
|
+
# Name symbol for the _setter association method
|
40
|
+
def _setter_method
|
41
|
+
:"_#{self[:name]}="
|
42
|
+
end
|
43
|
+
|
44
|
+
# Name symbol for the add association method
|
45
|
+
def add_method
|
46
|
+
:"add_#{singularize(self[:name])}"
|
47
|
+
end
|
48
|
+
|
49
|
+
# Name symbol for association method, the same as the name of the association.
|
50
|
+
def association_method
|
51
|
+
self[:name]
|
52
|
+
end
|
53
|
+
|
54
|
+
# The class associated to the current model class via this association
|
55
|
+
def associated_class
|
56
|
+
cached_fetch(:class){constantize(self[:class_name])}
|
57
|
+
end
|
58
|
+
|
59
|
+
# The dataset associated via this association, with the non-instance specific
|
60
|
+
# changes already applied. This will be a joined dataset if the association
|
61
|
+
# requires joining tables.
|
62
|
+
def associated_dataset
|
63
|
+
cached_fetch(:_dataset){apply_dataset_changes(_associated_dataset)}
|
64
|
+
end
|
65
|
+
|
66
|
+
# Apply all non-instance specific changes to the given dataset and return it.
|
67
|
+
def apply_dataset_changes(ds)
|
68
|
+
ds.extend(AssociationDatasetMethods)
|
69
|
+
ds.association_reflection = self
|
70
|
+
self[:extend].each{|m| ds.extend(m)}
|
71
|
+
ds = ds.select(*select) if select
|
72
|
+
if c = self[:conditions]
|
73
|
+
ds = (c.is_a?(Array) && !Sequel.condition_specifier?(c)) ? ds.where(*c) : ds.where(c)
|
74
|
+
end
|
75
|
+
ds = ds.order(*self[:order]) if self[:order]
|
76
|
+
ds = ds.limit(*self[:limit]) if self[:limit]
|
77
|
+
ds = ds.limit(1) if limit_to_single_row?
|
78
|
+
ds = ds.eager(*self[:eager]) if self[:eager]
|
79
|
+
ds = ds.distinct if self[:distinct]
|
80
|
+
ds
|
81
|
+
end
|
82
|
+
|
83
|
+
# Apply all non-instance specific changes and the eager_block option to the given
|
84
|
+
# dataset and return it.
|
85
|
+
def apply_eager_dataset_changes(ds)
|
86
|
+
ds = apply_dataset_changes(ds)
|
87
|
+
if block = self[:eager_block]
|
88
|
+
ds = block.call(ds)
|
89
|
+
end
|
90
|
+
ds
|
91
|
+
end
|
92
|
+
|
93
|
+
# Apply the eager graph limit strategy to the dataset to graph into the current dataset, or return
|
94
|
+
# the dataset unmodified if no SQL limit strategy is needed.
|
95
|
+
def apply_eager_graph_limit_strategy(strategy, ds)
|
96
|
+
case strategy
|
97
|
+
when :distinct_on
|
98
|
+
apply_distinct_on_eager_limit_strategy(ds.order_prepend(*self[:order]))
|
99
|
+
when :window_function
|
100
|
+
apply_window_function_eager_limit_strategy(ds.order_prepend(*self[:order])).select(*ds.columns)
|
101
|
+
else
|
102
|
+
ds
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
# Apply an eager limit strategy to the dataset, or return the dataset
|
107
|
+
# unmodified if it doesn't need an eager limit strategy.
|
108
|
+
def apply_eager_limit_strategy(ds, strategy=eager_limit_strategy)
|
109
|
+
case strategy
|
110
|
+
when :distinct_on
|
111
|
+
apply_distinct_on_eager_limit_strategy(ds)
|
112
|
+
when :window_function
|
113
|
+
apply_window_function_eager_limit_strategy(ds)
|
114
|
+
else
|
115
|
+
ds
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
# Use DISTINCT ON and ORDER BY clauses to limit the results to the first record with matching keys.
|
120
|
+
def apply_distinct_on_eager_limit_strategy(ds)
|
121
|
+
keys = predicate_key
|
122
|
+
ds.distinct(*keys).order_prepend(*keys)
|
123
|
+
end
|
124
|
+
|
125
|
+
# Use a window function to limit the results of the eager loading dataset.
|
126
|
+
def apply_window_function_eager_limit_strategy(ds)
|
127
|
+
rn = ds.row_number_column
|
128
|
+
limit, offset = limit_and_offset
|
129
|
+
ds = ds.unordered.select_append{|o| o.row_number{}.over(:partition=>predicate_key, :order=>ds.opts[:order]).as(rn)}.from_self
|
130
|
+
ds = if !returns_array?
|
131
|
+
ds.where(rn => offset ? offset+1 : 1)
|
132
|
+
elsif offset
|
133
|
+
offset += 1
|
134
|
+
if limit
|
135
|
+
ds.where(rn => (offset...(offset+limit)))
|
136
|
+
else
|
137
|
+
ds.where{SQL::Identifier.new(rn) >= offset}
|
138
|
+
end
|
139
|
+
else
|
140
|
+
ds.where{SQL::Identifier.new(rn) <= limit}
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
# If the ruby eager limit strategy is being used, slice the array using the slice
|
145
|
+
# range to return the object(s) at the correct offset/limit.
|
146
|
+
def apply_ruby_eager_limit_strategy(rows)
|
147
|
+
if eager_limit_strategy == :ruby
|
148
|
+
name = self[:name]
|
149
|
+
if returns_array?
|
150
|
+
range = slice_range
|
151
|
+
rows.each{|o| o.associations[name] = o.associations[name][range] || []}
|
152
|
+
elsif slice_range
|
153
|
+
offset = slice_range.begin
|
154
|
+
rows.each{|o| o.associations[name] = o.associations[name][offset]}
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
# Whether the associations cache should use an array when storing the
|
160
|
+
# associated records during eager loading.
|
161
|
+
def assign_singular?
|
162
|
+
!returns_array?
|
163
|
+
end
|
164
|
+
|
165
|
+
# Whether this association can have associated objects, given the current
|
166
|
+
# object. Should be false if obj cannot have associated objects because
|
167
|
+
# the necessary key columns are NULL.
|
168
|
+
def can_have_associated_objects?(obj)
|
169
|
+
true
|
170
|
+
end
|
171
|
+
|
172
|
+
# Whether you are able to clone from the given association type to the current
|
173
|
+
# association type, true by default only if the types match.
|
174
|
+
def cloneable?(ref)
|
175
|
+
ref[:type] == self[:type]
|
176
|
+
end
|
177
|
+
|
178
|
+
# Name symbol for the dataset association method
|
179
|
+
def dataset_method
|
180
|
+
:"#{self[:name]}_dataset"
|
181
|
+
end
|
182
|
+
|
183
|
+
# Whether the dataset needs a primary key to function, true by default.
|
184
|
+
def dataset_need_primary_key?
|
185
|
+
true
|
186
|
+
end
|
187
|
+
|
188
|
+
# Return the symbol used for the row number column if the window function
|
189
|
+
# eager limit strategy is being used, or nil otherwise.
|
190
|
+
def delete_row_number_column(ds=associated_dataset)
|
191
|
+
if eager_limit_strategy == :window_function
|
192
|
+
ds.row_number_column
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
# Return an dataset that will load the appropriate associated objects for
|
197
|
+
# the given object using this association.
|
198
|
+
def association_dataset_for(object)
|
199
|
+
associated_dataset.where(predicate_keys.zip(predicate_key_values(object)))
|
200
|
+
end
|
201
|
+
|
202
|
+
ASSOCIATION_DATASET_PROC = proc{|r| r.association_dataset_for(self)}
|
203
|
+
# Proc used to create the association dataset method.
|
204
|
+
def association_dataset_proc
|
205
|
+
ASSOCIATION_DATASET_PROC
|
206
|
+
end
|
207
|
+
|
208
|
+
# The eager_graph limit strategy to use for this dataset
|
209
|
+
def eager_graph_limit_strategy(strategy)
|
210
|
+
if self[:limit] || !returns_array?
|
211
|
+
strategy = strategy[self[:name]] if strategy.is_a?(Hash)
|
212
|
+
case strategy
|
213
|
+
when true
|
214
|
+
true_eager_graph_limit_strategy
|
215
|
+
when Symbol
|
216
|
+
strategy
|
217
|
+
else
|
218
|
+
if returns_array? || offset
|
219
|
+
:ruby
|
220
|
+
end
|
221
|
+
end
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
# The eager limit strategy to use for this dataset.
|
226
|
+
def eager_limit_strategy
|
227
|
+
cached_fetch(:_eager_limit_strategy) do
|
228
|
+
if self[:limit] || !returns_array?
|
229
|
+
case s = cached_fetch(:eager_limit_strategy){default_eager_limit_strategy}
|
230
|
+
when true
|
231
|
+
true_eager_limit_strategy
|
232
|
+
else
|
233
|
+
s
|
234
|
+
end
|
235
|
+
end
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
239
|
+
# Eager load the associated objects using the hash of eager options,
|
240
|
+
# yielding each row to the block.
|
241
|
+
def eager_load_results(eo, &block)
|
242
|
+
rows = eo[:rows]
|
243
|
+
initialize_association_cache(rows) unless eo[:initialize_rows] == false
|
244
|
+
strategy = eager_limit_strategy
|
245
|
+
cascade = eo[:associations]
|
246
|
+
|
247
|
+
if eo[:eager_block] || eo[:loader] == false
|
248
|
+
strategy = true_eager_graph_limit_strategy if strategy == :union
|
249
|
+
objects = apply_eager_limit_strategy(eager_loading_dataset(eo), strategy).all
|
250
|
+
elsif strategy == :union
|
251
|
+
objects = []
|
252
|
+
ds = associated_dataset
|
253
|
+
loader = union_eager_loader
|
254
|
+
joiner = " UNION ALL "
|
255
|
+
eo[:id_map].keys.each_slice(subqueries_per_union).each do |slice|
|
256
|
+
objects.concat(ds.with_sql(slice.map{|k| loader.sql(*k)}.join(joiner)).to_a)
|
257
|
+
end
|
258
|
+
ds = ds.eager(cascade) if cascade
|
259
|
+
ds.send(:post_load, objects)
|
260
|
+
else
|
261
|
+
loader = placeholder_eager_loader
|
262
|
+
loader = loader.with_dataset{|ds| ds.eager(cascade)} if cascade
|
263
|
+
objects = loader.all(eo[:id_map].keys)
|
264
|
+
end
|
265
|
+
|
266
|
+
objects.each(&block)
|
267
|
+
apply_ruby_eager_limit_strategy(rows)
|
268
|
+
end
|
269
|
+
|
270
|
+
# The key to use for the key hash when eager loading
|
271
|
+
def eager_loader_key
|
272
|
+
self[:eager_loader_key]
|
273
|
+
end
|
274
|
+
|
275
|
+
# By default associations do not need to select a key in an associated table
|
276
|
+
# to eagerly load.
|
277
|
+
def eager_loading_use_associated_key?
|
278
|
+
false
|
279
|
+
end
|
280
|
+
|
281
|
+
# Alias of predicate_key, only for backwards compatibility.
|
282
|
+
def eager_loading_predicate_key
|
283
|
+
predicate_key
|
284
|
+
end
|
285
|
+
|
286
|
+
# Whether to eagerly graph a lazy dataset, true by default. If this
|
287
|
+
# is false, the association won't respect the :eager_graph option
|
288
|
+
# when loading the association for a single record.
|
289
|
+
def eager_graph_lazy_dataset?
|
290
|
+
true
|
291
|
+
end
|
292
|
+
|
293
|
+
# Whether additional conditions should be added when using the filter
|
294
|
+
# by associations support.
|
295
|
+
def filter_by_associations_add_conditions?
|
296
|
+
self[:conditions] || self[:eager_block] || self[:limit]
|
297
|
+
end
|
298
|
+
|
299
|
+
# The expression to use for the additional conditions to be added for
|
300
|
+
# the filter by association support, when the association itself is
|
301
|
+
# filtered. Works by using a subquery to test that the objects passed
|
302
|
+
# also meet the association filter criteria.
|
303
|
+
def filter_by_associations_conditions_expression(obj)
|
304
|
+
ds = filter_by_associations_conditions_dataset.where(filter_by_associations_conditions_subquery_conditions(obj))
|
305
|
+
{filter_by_associations_conditions_key=>ds}
|
306
|
+
end
|
307
|
+
|
308
|
+
# Whether to handle silent modification failure when adding/removing
|
309
|
+
# associated records, false by default.
|
310
|
+
def handle_silent_modification_failure?
|
311
|
+
false
|
312
|
+
end
|
313
|
+
|
314
|
+
# Initialize the associations cache for the current association for the given objects.
|
315
|
+
def initialize_association_cache(objects)
|
316
|
+
name = self[:name]
|
317
|
+
if assign_singular?
|
318
|
+
objects.each{|object| object.associations[name] = nil}
|
319
|
+
else
|
320
|
+
objects.each{|object| object.associations[name] = []}
|
321
|
+
end
|
322
|
+
end
|
323
|
+
|
324
|
+
# The limit and offset for this association (returned as a two element array).
|
325
|
+
def limit_and_offset
|
326
|
+
if (v = self[:limit]).is_a?(Array)
|
327
|
+
v
|
328
|
+
else
|
329
|
+
[v, nil]
|
330
|
+
end
|
331
|
+
end
|
332
|
+
|
333
|
+
# Whether the associated object needs a primary key to be added/removed,
|
334
|
+
# false by default.
|
335
|
+
def need_associated_primary_key?
|
336
|
+
false
|
337
|
+
end
|
338
|
+
|
339
|
+
# A placeholder literalizer that can be used to lazily load the association. If
|
340
|
+
# one can't be used, returns nil.
|
341
|
+
def placeholder_loader
|
342
|
+
if use_placeholder_loader?
|
343
|
+
cached_fetch(:placeholder_loader) do
|
344
|
+
Sequel::Dataset::PlaceholderLiteralizer.loader(associated_dataset) do |pl, ds|
|
345
|
+
ds.where(*predicate_keys.map{|k| SQL::BooleanExpression.new(:'=', k, pl.arg)})
|
346
|
+
end
|
347
|
+
end
|
348
|
+
end
|
349
|
+
end
|
350
|
+
|
351
|
+
# The keys to use for loading of the regular dataset, as an array.
|
352
|
+
def predicate_keys
|
353
|
+
cached_fetch(:predicate_keys){Array(predicate_key)}
|
354
|
+
end
|
355
|
+
|
356
|
+
# The values that predicate_keys should match for objects to be associated.
|
357
|
+
def predicate_key_values(object)
|
358
|
+
predicate_key_methods.map{|k| object.send(k)}
|
359
|
+
end
|
360
|
+
|
361
|
+
# Qualify +col+ with the given table name. If +col+ is an array of columns,
|
362
|
+
# return an array of qualified columns. Only qualifies Symbols and SQL::Identifier
|
363
|
+
# values, other values are not modified.
|
364
|
+
def qualify(table, col)
|
365
|
+
transform(col) do |k|
|
366
|
+
case k
|
367
|
+
when Symbol, SQL::Identifier
|
368
|
+
SQL::QualifiedIdentifier.new(table, k)
|
369
|
+
else
|
370
|
+
Sequel::Qualifier.new(self[:model].dataset, table).transform(k)
|
371
|
+
end
|
372
|
+
end
|
373
|
+
end
|
374
|
+
|
375
|
+
# Qualify col with the associated model's table name.
|
376
|
+
def qualify_assoc(col)
|
377
|
+
qualify(associated_class.table_name, col)
|
378
|
+
end
|
379
|
+
|
380
|
+
# Qualify col with the current model's table name.
|
381
|
+
def qualify_cur(col)
|
382
|
+
qualify(self[:model].table_name, col)
|
383
|
+
end
|
384
|
+
|
385
|
+
# Returns the reciprocal association variable, if one exists. The reciprocal
|
386
|
+
# association is the association in the associated class that is the opposite
|
387
|
+
# of the current association. For example, Album.many_to_one :artist and
|
388
|
+
# Artist.one_to_many :albums are reciprocal associations. This information is
|
389
|
+
# to populate reciprocal associations. For example, when you do this_artist.add_album(album)
|
390
|
+
# it sets album.artist to this_artist.
|
391
|
+
def reciprocal
|
392
|
+
cached_fetch(:reciprocal) do
|
393
|
+
possible_recips = []
|
394
|
+
|
395
|
+
associated_class.all_association_reflections.each do |assoc_reflect|
|
396
|
+
if reciprocal_association?(assoc_reflect)
|
397
|
+
possible_recips << assoc_reflect
|
398
|
+
end
|
399
|
+
end
|
400
|
+
|
401
|
+
if possible_recips.length == 1
|
402
|
+
cached_set(:reciprocal_type, possible_recips.first[:type]) if ambiguous_reciprocal_type?
|
403
|
+
possible_recips.first[:name]
|
404
|
+
end
|
405
|
+
end
|
406
|
+
end
|
407
|
+
|
408
|
+
# Whether the reciprocal of this association returns an array of objects instead of a single object,
|
409
|
+
# true by default.
|
410
|
+
def reciprocal_array?
|
411
|
+
true
|
412
|
+
end
|
413
|
+
|
414
|
+
# Name symbol for the remove_all_ association method
|
415
|
+
def remove_all_method
|
416
|
+
:"remove_all_#{self[:name]}"
|
417
|
+
end
|
418
|
+
|
419
|
+
# Whether associated objects need to be removed from the association before
|
420
|
+
# being destroyed in order to preserve referential integrity.
|
421
|
+
def remove_before_destroy?
|
422
|
+
true
|
423
|
+
end
|
424
|
+
|
425
|
+
# Name symbol for the remove_ association method
|
426
|
+
def remove_method
|
427
|
+
:"remove_#{singularize(self[:name])}"
|
428
|
+
end
|
429
|
+
|
430
|
+
# Whether to check that an object to be disassociated is already associated to this object, false by default.
|
431
|
+
def remove_should_check_existing?
|
432
|
+
false
|
433
|
+
end
|
434
|
+
|
435
|
+
# Whether this association returns an array of objects instead of a single object,
|
436
|
+
# true by default.
|
437
|
+
def returns_array?
|
438
|
+
true
|
439
|
+
end
|
440
|
+
|
441
|
+
# The columns to select when loading the association.
|
442
|
+
def select
|
443
|
+
self[:select]
|
444
|
+
end
|
445
|
+
|
446
|
+
# Whether to set the reciprocal association to self when loading associated
|
447
|
+
# records, false by default.
|
448
|
+
def set_reciprocal_to_self?
|
449
|
+
false
|
450
|
+
end
|
451
|
+
|
452
|
+
# Name symbol for the setter association method
|
453
|
+
def setter_method
|
454
|
+
:"#{self[:name]}="
|
455
|
+
end
|
456
|
+
|
457
|
+
# The range used for slicing when using the :ruby eager limit strategy.
|
458
|
+
def slice_range
|
459
|
+
limit, offset = limit_and_offset
|
460
|
+
if limit || offset
|
461
|
+
(offset||0)..(limit ? (offset||0)+limit-1 : -1)
|
462
|
+
end
|
463
|
+
end
|
464
|
+
|
465
|
+
private
|
466
|
+
|
467
|
+
if defined?(RUBY_ENGINE) && RUBY_ENGINE != 'ruby'
|
468
|
+
# :nocov:
|
469
|
+
# On non-GVL rubies, assume the need to synchronize access. Store the key
|
470
|
+
# in a special sub-hash that always uses this method to synchronize access.
|
471
|
+
def cached_fetch(key)
|
472
|
+
fetch(key) do
|
473
|
+
return yield unless h = self[:cache]
|
474
|
+
Sequel.synchronize{return h[key] if h.has_key?(key)}
|
475
|
+
value = yield
|
476
|
+
Sequel.synchronize{h[key] = value}
|
477
|
+
end
|
478
|
+
end
|
479
|
+
|
480
|
+
# Cache the value at the given key, synchronizing access.
|
481
|
+
def cached_set(key, value)
|
482
|
+
return unless h = self[:cache]
|
483
|
+
Sequel.synchronize{h[key] = value}
|
484
|
+
end
|
485
|
+
# :nocov:
|
486
|
+
else
|
487
|
+
# On MRI, use a plain fetch, since the GVL will synchronize access.
|
488
|
+
def cached_fetch(key)
|
489
|
+
fetch(key) do
|
490
|
+
return yield unless h = self[:cache]
|
491
|
+
h.fetch(key){h[key] = yield}
|
492
|
+
end
|
493
|
+
end
|
494
|
+
|
495
|
+
# On MRI, just set the value at the key in the cache, since the GVL
|
496
|
+
# will synchronize access.
|
497
|
+
def cached_set(key, value)
|
498
|
+
return unless h = self[:cache]
|
499
|
+
h[key] = value
|
500
|
+
end
|
501
|
+
end
|
502
|
+
|
503
|
+
# The base dataset used for the association, before any order/conditions
|
504
|
+
# options have been applied.
|
505
|
+
def _associated_dataset
|
506
|
+
associated_class.dataset.clone
|
507
|
+
end
|
508
|
+
|
509
|
+
# Whether for the reciprocal type for the given association can not be
|
510
|
+
# known in advantage, false by default.
|
511
|
+
def ambiguous_reciprocal_type?
|
512
|
+
false
|
513
|
+
end
|
514
|
+
|
515
|
+
# Apply a limit strategy to the given dataset so that filter by
|
516
|
+
# associations works with a limited dataset.
|
517
|
+
def apply_filter_by_associations_limit_strategy(ds)
|
518
|
+
case filter_by_associations_limit_strategy
|
519
|
+
when :distinct_on
|
520
|
+
apply_filter_by_associations_distinct_on_limit_strategy(ds)
|
521
|
+
when :window_function
|
522
|
+
apply_filter_by_associations_window_function_limit_strategy(ds)
|
523
|
+
else
|
524
|
+
ds
|
525
|
+
end
|
526
|
+
end
|
527
|
+
|
528
|
+
# Apply a distinct on eager limit strategy using IN with a subquery
|
529
|
+
# that uses DISTINCT ON to ensure only the first matching record for
|
530
|
+
# each key is included.
|
531
|
+
def apply_filter_by_associations_distinct_on_limit_strategy(ds)
|
532
|
+
k = filter_by_associations_limit_key
|
533
|
+
ds.where(k=>apply_distinct_on_eager_limit_strategy(associated_eager_dataset.select(*k)))
|
534
|
+
end
|
535
|
+
|
536
|
+
# Apply a distinct on eager limit strategy using IN with a subquery
|
537
|
+
# that uses a filter on the row_number window function to ensure
|
538
|
+
# that only rows inside the limit are returned.
|
539
|
+
def apply_filter_by_associations_window_function_limit_strategy(ds)
|
540
|
+
ds.where(filter_by_associations_limit_key=>apply_window_function_eager_limit_strategy(associated_eager_dataset.select(*filter_by_associations_limit_alias_key)).select(*filter_by_associations_limit_aliases))
|
541
|
+
end
|
542
|
+
|
543
|
+
# The associated_dataset with the eager_block callback already applied.
|
544
|
+
def associated_eager_dataset
|
545
|
+
cached_fetch(:associated_eager_dataset) do
|
546
|
+
ds = associated_dataset.unlimited
|
547
|
+
if block = self[:eager_block]
|
548
|
+
ds = block.call(ds)
|
549
|
+
end
|
550
|
+
ds
|
551
|
+
end
|
552
|
+
end
|
553
|
+
|
554
|
+
# The dataset to use for eager loading associated objects for multiple current objects,
|
555
|
+
# given the hash passed to the eager loader.
|
556
|
+
def eager_loading_dataset(eo=OPTS)
|
557
|
+
ds = eo[:dataset] || associated_eager_dataset
|
558
|
+
if id_map = eo[:id_map]
|
559
|
+
ds = ds.where(eager_loading_predicate_condition(id_map.keys))
|
560
|
+
end
|
561
|
+
if associations = eo[:associations]
|
562
|
+
ds = ds.eager(associations)
|
563
|
+
end
|
564
|
+
if block = eo[:eager_block]
|
565
|
+
ds = block.call(ds)
|
566
|
+
end
|
567
|
+
if eager_loading_use_associated_key?
|
568
|
+
ds = ds.select_append(*associated_key_array)
|
569
|
+
end
|
570
|
+
if self[:eager_graph]
|
571
|
+
raise(Error, "cannot eagerly load a #{self[:type]} association that uses :eager_graph") if eager_loading_use_associated_key?
|
572
|
+
ds = ds.eager_graph(self[:eager_graph])
|
573
|
+
end
|
574
|
+
ds
|
575
|
+
end
|
576
|
+
|
577
|
+
# The default eager limit strategy to use for this association
|
578
|
+
def default_eager_limit_strategy
|
579
|
+
self[:model].default_eager_limit_strategy || :ruby
|
580
|
+
end
|
581
|
+
|
582
|
+
# The predicate condition to use for the eager_loader.
|
583
|
+
def eager_loading_predicate_condition(keys)
|
584
|
+
{predicate_key=>keys}
|
585
|
+
end
|
586
|
+
|
587
|
+
# Add conditions to the dataset to not include NULL values for
|
588
|
+
# the associated keys, and select those keys.
|
589
|
+
def filter_by_associations_add_conditions_dataset_filter(ds)
|
590
|
+
k = filter_by_associations_conditions_associated_keys
|
591
|
+
ds.select(*k).where(Sequel.negate(k.zip([])))
|
592
|
+
end
|
593
|
+
|
594
|
+
# The conditions to add to the filter by associations conditions
|
595
|
+
# subquery to restrict it to to the object(s) that was used as the
|
596
|
+
# filter value.
|
597
|
+
def filter_by_associations_conditions_subquery_conditions(obj)
|
598
|
+
key = qualify(associated_class.table_name, associated_class.primary_key)
|
599
|
+
case obj
|
600
|
+
when Array
|
601
|
+
{key=>obj.map{|o| o.pk}}
|
602
|
+
when Sequel::Dataset
|
603
|
+
{key=>obj.select(*Array(qualify(associated_class.table_name, associated_class.primary_key)))}
|
604
|
+
else
|
605
|
+
Array(key).zip(Array(obj.pk))
|
606
|
+
end
|
607
|
+
end
|
608
|
+
|
609
|
+
# The base dataset to use for the filter by associations conditions
|
610
|
+
# subquery, regardless of the objects that are passed in as filter
|
611
|
+
# values.
|
612
|
+
def filter_by_associations_conditions_dataset
|
613
|
+
cached_fetch(:filter_by_associations_conditions_dataset) do
|
614
|
+
ds = associated_eager_dataset.unordered
|
615
|
+
ds = filter_by_associations_add_conditions_dataset_filter(ds)
|
616
|
+
ds = apply_filter_by_associations_limit_strategy(ds)
|
617
|
+
ds
|
618
|
+
end
|
619
|
+
end
|
620
|
+
|
621
|
+
# The strategy to use to filter by a limited association
|
622
|
+
def filter_by_associations_limit_strategy
|
623
|
+
v = fetch(:filter_limit_strategy, self[:eager_limit_strategy])
|
624
|
+
if v || self[:limit] || !returns_array?
|
625
|
+
case v ||= self[:model].default_eager_limit_strategy
|
626
|
+
when :union, :ruby
|
627
|
+
# Can't use a union or ruby-based strategy for filtering by associations, switch to default eager graph limit
|
628
|
+
# strategy.
|
629
|
+
true_eager_graph_limit_strategy
|
630
|
+
when Symbol
|
631
|
+
v
|
632
|
+
when true
|
633
|
+
true_eager_graph_limit_strategy
|
634
|
+
end
|
635
|
+
end
|
636
|
+
end
|
637
|
+
|
638
|
+
# Whether to limit the associated dataset to a single row.
|
639
|
+
def limit_to_single_row?
|
640
|
+
!returns_array?
|
641
|
+
end
|
642
|
+
|
643
|
+
# Any offset to use for this association (or nil if there is no offset).
|
644
|
+
def offset
|
645
|
+
limit_and_offset.last
|
646
|
+
end
|
647
|
+
|
648
|
+
# A placeholder literalizer used to speed up eager loading.
|
649
|
+
def placeholder_eager_loader
|
650
|
+
cached_fetch(:placeholder_eager_loader) do
|
651
|
+
Sequel::Dataset::PlaceholderLiteralizer.loader(associated_dataset) do |pl, ds|
|
652
|
+
apply_eager_limit_strategy(eager_loading_dataset.where(predicate_key=>pl.arg), eager_limit_strategy)
|
653
|
+
end
|
654
|
+
end
|
655
|
+
end
|
656
|
+
|
657
|
+
# The reciprocal type as an array, should be overridden in reflection subclasses that
|
658
|
+
# have ambiguous reciprocal types.
|
659
|
+
def possible_reciprocal_types
|
660
|
+
[reciprocal_type]
|
661
|
+
end
|
662
|
+
|
663
|
+
# Whether the given association reflection is possible reciprocal
|
664
|
+
# association for the current association reflection.
|
665
|
+
def reciprocal_association?(assoc_reflect)
|
666
|
+
possible_reciprocal_types.include?(assoc_reflect[:type]) &&
|
667
|
+
(begin; assoc_reflect.associated_class; rescue NameError; end) == self[:model] &&
|
668
|
+
assoc_reflect[:conditions].nil? &&
|
669
|
+
assoc_reflect[:block].nil?
|
670
|
+
end
|
671
|
+
|
672
|
+
# The number of subqueries to use in each union query, used to eagerly load
|
673
|
+
# limited associations. Defaults to 40, the optimal number depends on the
|
674
|
+
# latency between the database and the application.
|
675
|
+
def subqueries_per_union
|
676
|
+
self[:subqueries_per_union] || 40
|
677
|
+
end
|
678
|
+
|
679
|
+
# If +s+ is an array, map +s+ over the block. Otherwise, just call the
|
680
|
+
# block with +s+.
|
681
|
+
def transform(s)
|
682
|
+
s.is_a?(Array) ? s.map(&Proc.new) : (yield s)
|
683
|
+
end
|
684
|
+
|
685
|
+
# What eager limit strategy should be used when true is given as the value,
|
686
|
+
# defaults to UNION as that is the fastest strategy if the appropriate keys are indexed.
|
687
|
+
def true_eager_limit_strategy
|
688
|
+
if self[:eager_graph] || (offset && !associated_dataset.supports_offsets_in_correlated_subqueries?)
|
689
|
+
# An SQL-based approach won't work if you are also eager graphing,
|
690
|
+
# so use a ruby based approach in that case.
|
691
|
+
:ruby
|
692
|
+
else
|
693
|
+
:union
|
694
|
+
end
|
695
|
+
end
|
696
|
+
|
697
|
+
# The eager_graph limit strategy used when true is given as the value, choosing the
|
698
|
+
# best strategy based on what the database supports.
|
699
|
+
def true_eager_graph_limit_strategy
|
700
|
+
if associated_class.dataset.supports_window_functions?
|
701
|
+
:window_function
|
702
|
+
else
|
703
|
+
:ruby
|
704
|
+
end
|
705
|
+
end
|
706
|
+
|
707
|
+
# A placeholder literalizer used to speed up the creation of union queries when eager
|
708
|
+
# loading a limited association.
|
709
|
+
def union_eager_loader
|
710
|
+
cached_fetch(:union_eager_loader) do
|
711
|
+
Sequel::Dataset::PlaceholderLiteralizer.loader(associated_dataset) do |pl, ds|
|
712
|
+
ds = self[:eager_block].call(ds) if self[:eager_block]
|
713
|
+
keys = predicate_keys
|
714
|
+
ds = ds.where(keys.map{pl.arg}.zip(keys))
|
715
|
+
if eager_loading_use_associated_key?
|
716
|
+
ds = ds.select_append(*associated_key_array)
|
717
|
+
end
|
718
|
+
ds.from_self
|
719
|
+
end
|
720
|
+
end
|
721
|
+
end
|
722
|
+
|
723
|
+
# Whether the placeholder loader can be used to load the association.
|
724
|
+
def use_placeholder_loader?
|
725
|
+
!self[:instance_specific] && !self[:eager_graph]
|
726
|
+
end
|
727
|
+
end
|
728
|
+
|
729
|
+
class ManyToOneAssociationReflection < AssociationReflection
|
730
|
+
ASSOCIATION_TYPES[:many_to_one] = self
|
731
|
+
|
732
|
+
# many_to_one associations can only have associated objects if none of
|
733
|
+
# the :keys options have a nil value.
|
734
|
+
def can_have_associated_objects?(obj)
|
735
|
+
!self[:keys].any?{|k| obj.send(k).nil?}
|
736
|
+
end
|
737
|
+
|
738
|
+
# Whether the dataset needs a primary key to function, false for many_to_one associations.
|
739
|
+
def dataset_need_primary_key?
|
740
|
+
false
|
741
|
+
end
|
742
|
+
|
743
|
+
# Default foreign key name symbol for foreign key in current model's table that points to
|
744
|
+
# the given association's table's primary key.
|
745
|
+
def default_key
|
746
|
+
:"#{self[:name]}_id"
|
747
|
+
end
|
748
|
+
|
749
|
+
# Whether to eagerly graph a lazy dataset, true for many_to_one associations
|
750
|
+
# only if the key is nil.
|
751
|
+
def eager_graph_lazy_dataset?
|
752
|
+
self[:key].nil?
|
753
|
+
end
|
754
|
+
|
755
|
+
# many_to_one associations don't need an eager_graph limit strategy
|
756
|
+
def eager_graph_limit_strategy(_)
|
757
|
+
nil
|
758
|
+
end
|
759
|
+
|
760
|
+
# many_to_one associations don't need an eager limit strategy
|
761
|
+
def eager_limit_strategy
|
762
|
+
nil
|
763
|
+
end
|
764
|
+
|
765
|
+
# many_to_one associations don't need a filter by associations limit strategy
|
766
|
+
def filter_by_associations_limit_strategy
|
767
|
+
nil
|
768
|
+
end
|
769
|
+
|
770
|
+
# The expression to use on the left hand side of the IN lookup when eager loading
|
771
|
+
def predicate_key
|
772
|
+
cached_fetch(:predicate_key){qualified_primary_key}
|
773
|
+
end
|
774
|
+
|
775
|
+
# The column(s) in the associated table that the key in the current table references (either a symbol or an array).
|
776
|
+
def primary_key
|
777
|
+
cached_fetch(:primary_key){associated_class.primary_key || raise(Error, "no primary key specified for #{associated_class.inspect}")}
|
778
|
+
end
|
779
|
+
|
780
|
+
# The columns in the associated table that the key in the current table references (always an array).
|
781
|
+
def primary_keys
|
782
|
+
cached_fetch(:primary_keys){Array(primary_key)}
|
783
|
+
end
|
784
|
+
alias associated_object_keys primary_keys
|
785
|
+
|
786
|
+
# The method symbol or array of method symbols to call on the associated object
|
787
|
+
# to get the value to use for the foreign keys.
|
788
|
+
def primary_key_method
|
789
|
+
cached_fetch(:primary_key_method){primary_key}
|
790
|
+
end
|
791
|
+
|
792
|
+
# The array of method symbols to call on the associated object
|
793
|
+
# to get the value to use for the foreign keys.
|
794
|
+
def primary_key_methods
|
795
|
+
cached_fetch(:primary_key_methods){Array(primary_key_method)}
|
796
|
+
end
|
797
|
+
|
798
|
+
# #primary_key qualified by the associated table
|
799
|
+
def qualified_primary_key
|
800
|
+
cached_fetch(:qualified_primary_key){self[:qualify] == false ? primary_key : qualify_assoc(primary_key)}
|
801
|
+
end
|
802
|
+
|
803
|
+
# True only if the reciprocal is a one_to_many association.
|
804
|
+
def reciprocal_array?
|
805
|
+
!set_reciprocal_to_self?
|
806
|
+
end
|
807
|
+
|
808
|
+
# Whether this association returns an array of objects instead of a single object,
|
809
|
+
# false for a many_to_one association.
|
810
|
+
def returns_array?
|
811
|
+
false
|
812
|
+
end
|
813
|
+
|
814
|
+
# True only if the reciprocal is a one_to_one association.
|
815
|
+
def set_reciprocal_to_self?
|
816
|
+
reciprocal
|
817
|
+
reciprocal_type == :one_to_one
|
818
|
+
end
|
819
|
+
|
820
|
+
private
|
821
|
+
|
822
|
+
# Reciprocals of many_to_one associations could be either one_to_many or one_to_one,
|
823
|
+
# and which is not known in advance.
|
824
|
+
def ambiguous_reciprocal_type?
|
825
|
+
true
|
826
|
+
end
|
827
|
+
|
828
|
+
def filter_by_associations_conditions_associated_keys
|
829
|
+
qualify(associated_class.table_name, primary_keys)
|
830
|
+
end
|
831
|
+
|
832
|
+
def filter_by_associations_conditions_key
|
833
|
+
qualify(self[:model].table_name, self[:key_column])
|
834
|
+
end
|
835
|
+
|
836
|
+
# many_to_one associations do not need to be limited to a single row if they
|
837
|
+
# explicitly do not have a key.
|
838
|
+
def limit_to_single_row?
|
839
|
+
super && self[:key]
|
840
|
+
end
|
841
|
+
|
842
|
+
def predicate_key_methods
|
843
|
+
self[:keys]
|
844
|
+
end
|
845
|
+
|
846
|
+
# The reciprocal type of a many_to_one association is either
|
847
|
+
# a one_to_many or a one_to_one association.
|
848
|
+
def possible_reciprocal_types
|
849
|
+
[:one_to_many, :one_to_one]
|
850
|
+
end
|
851
|
+
|
852
|
+
# Whether the given association reflection is possible reciprocal
|
853
|
+
def reciprocal_association?(assoc_reflect)
|
854
|
+
super && self[:keys] == assoc_reflect[:keys] && primary_key == assoc_reflect.primary_key
|
855
|
+
end
|
856
|
+
|
857
|
+
# The reciprocal type of a many_to_one association is either
|
858
|
+
# a one_to_many or a one_to_one association, look in the associated class
|
859
|
+
# to try to figure out which.
|
860
|
+
def reciprocal_type
|
861
|
+
cached_fetch(:reciprocal_type) do
|
862
|
+
possible_recips = []
|
863
|
+
|
864
|
+
associated_class.all_association_reflections.each do |assoc_reflect|
|
865
|
+
if reciprocal_association?(assoc_reflect)
|
866
|
+
possible_recips << assoc_reflect
|
867
|
+
end
|
868
|
+
end
|
869
|
+
|
870
|
+
if possible_recips.length == 1
|
871
|
+
possible_recips.first[:type]
|
872
|
+
else
|
873
|
+
possible_reciprocal_types
|
874
|
+
end
|
875
|
+
end
|
876
|
+
end
|
877
|
+
end
|
878
|
+
|
879
|
+
class OneToManyAssociationReflection < AssociationReflection
|
880
|
+
ASSOCIATION_TYPES[:one_to_many] = self
|
881
|
+
|
882
|
+
# Support a correlated subquery limit strategy when using eager_graph.
|
883
|
+
def apply_eager_graph_limit_strategy(strategy, ds)
|
884
|
+
case strategy
|
885
|
+
when :correlated_subquery
|
886
|
+
apply_correlated_subquery_limit_strategy(ds)
|
887
|
+
else
|
888
|
+
super
|
889
|
+
end
|
890
|
+
end
|
891
|
+
|
892
|
+
# The keys in the associated model's table related to this association
|
893
|
+
def associated_object_keys
|
894
|
+
self[:keys]
|
895
|
+
end
|
896
|
+
|
897
|
+
# one_to_many associations can only have associated objects if none of
|
898
|
+
# the :keys options have a nil value.
|
899
|
+
def can_have_associated_objects?(obj)
|
900
|
+
!self[:primary_keys].any?{|k| obj.send(k).nil?}
|
901
|
+
end
|
902
|
+
|
903
|
+
# one_to_many and one_to_one associations can be clones
|
904
|
+
def cloneable?(ref)
|
905
|
+
ref[:type] == :one_to_many || ref[:type] == :one_to_one
|
906
|
+
end
|
907
|
+
|
908
|
+
# Default foreign key name symbol for key in associated table that points to
|
909
|
+
# current table's primary key.
|
910
|
+
def default_key
|
911
|
+
:"#{underscore(demodulize(self[:model].name))}_id"
|
912
|
+
end
|
913
|
+
|
914
|
+
# Handle silent failure of add/remove methods if raise_on_save_failure is false.
|
915
|
+
def handle_silent_modification_failure?
|
916
|
+
self[:raise_on_save_failure] == false
|
917
|
+
end
|
918
|
+
|
919
|
+
# The hash key to use for the eager loading predicate (left side of IN (1, 2, 3))
|
920
|
+
def predicate_key
|
921
|
+
cached_fetch(:predicate_key){qualify_assoc(self[:key])}
|
922
|
+
end
|
923
|
+
alias qualified_key predicate_key
|
924
|
+
|
925
|
+
# The column in the current table that the key in the associated table references.
|
926
|
+
def primary_key
|
927
|
+
self[:primary_key]
|
928
|
+
end
|
929
|
+
|
930
|
+
# #primary_key qualified by the current table
|
931
|
+
def qualified_primary_key
|
932
|
+
cached_fetch(:qualified_primary_key){qualify_cur(primary_key)}
|
933
|
+
end
|
934
|
+
|
935
|
+
# Whether the reciprocal of this association returns an array of objects instead of a single object,
|
936
|
+
# false for a one_to_many association.
|
937
|
+
def reciprocal_array?
|
938
|
+
false
|
939
|
+
end
|
940
|
+
|
941
|
+
# Destroying one_to_many associated objects automatically deletes the foreign key.
|
942
|
+
def remove_before_destroy?
|
943
|
+
false
|
944
|
+
end
|
945
|
+
|
946
|
+
# The one_to_many association needs to check that an object to be removed already is associated.
|
947
|
+
def remove_should_check_existing?
|
948
|
+
true
|
949
|
+
end
|
950
|
+
|
951
|
+
# One to many associations set the reciprocal to self when loading associated records.
|
952
|
+
def set_reciprocal_to_self?
|
953
|
+
true
|
954
|
+
end
|
955
|
+
|
956
|
+
private
|
957
|
+
|
958
|
+
# Use a correlated subquery to limit the dataset. Note that this will not
|
959
|
+
# work correctly if the associated dataset uses qualified identifers in the WHERE clause,
|
960
|
+
# as they would reference the containing query instead of the subquery.
|
961
|
+
def apply_correlated_subquery_limit_strategy(ds)
|
962
|
+
table = ds.first_source_table
|
963
|
+
table_alias = ds.first_source_alias
|
964
|
+
primary_key = associated_class.primary_key
|
965
|
+
key = self[:key]
|
966
|
+
cs_alias = :t1
|
967
|
+
cs = associated_dataset.
|
968
|
+
from(Sequel.as(table, :t1)).
|
969
|
+
select(*qualify(cs_alias, primary_key)).
|
970
|
+
where(Array(qualify(cs_alias, key)).zip(Array(qualify(table_alias, key)))).
|
971
|
+
limit(*limit_and_offset)
|
972
|
+
ds.where(qualify(table_alias, primary_key)=>cs)
|
973
|
+
end
|
974
|
+
|
975
|
+
# Support correlated subquery strategy when filtering by limited associations.
|
976
|
+
def apply_filter_by_associations_limit_strategy(ds)
|
977
|
+
case filter_by_associations_limit_strategy
|
978
|
+
when :correlated_subquery
|
979
|
+
apply_correlated_subquery_limit_strategy(ds)
|
980
|
+
else
|
981
|
+
super
|
982
|
+
end
|
983
|
+
end
|
984
|
+
|
985
|
+
def filter_by_associations_conditions_associated_keys
|
986
|
+
qualify(associated_class.table_name, self[:keys])
|
987
|
+
end
|
988
|
+
|
989
|
+
def filter_by_associations_conditions_key
|
990
|
+
qualify(self[:model].table_name, self[:primary_key_column])
|
991
|
+
end
|
992
|
+
|
993
|
+
def filter_by_associations_limit_alias_key
|
994
|
+
Array(filter_by_associations_limit_key)
|
995
|
+
end
|
996
|
+
|
997
|
+
def filter_by_associations_limit_aliases
|
998
|
+
filter_by_associations_limit_alias_key.map{|v| v.column}
|
999
|
+
end
|
1000
|
+
|
1001
|
+
def filter_by_associations_limit_key
|
1002
|
+
qualify(associated_class.table_name, associated_class.primary_key)
|
1003
|
+
end
|
1004
|
+
|
1005
|
+
def predicate_key_methods
|
1006
|
+
self[:primary_keys]
|
1007
|
+
end
|
1008
|
+
|
1009
|
+
def reciprocal_association?(assoc_reflect)
|
1010
|
+
super && self[:keys] == assoc_reflect[:keys] && primary_key == assoc_reflect.primary_key
|
1011
|
+
end
|
1012
|
+
|
1013
|
+
# The reciprocal type of a one_to_many association is a many_to_one association.
|
1014
|
+
def reciprocal_type
|
1015
|
+
:many_to_one
|
1016
|
+
end
|
1017
|
+
|
1018
|
+
# Support automatic use of correlated subqueries if :ruby option is best available option,
|
1019
|
+
# MySQL is not being used, and either the associated class has a non-composite primary key
|
1020
|
+
# or the database supports multiple columns in IN.
|
1021
|
+
def true_eager_graph_limit_strategy
|
1022
|
+
r = super
|
1023
|
+
ds = associated_dataset
|
1024
|
+
if r == :ruby && ds.supports_limits_in_correlated_subqueries? && (Array(associated_class.primary_key).length == 1 || ds.supports_multiple_column_in?) && (!offset || ds.supports_offsets_in_correlated_subqueries?)
|
1025
|
+
:correlated_subquery
|
1026
|
+
else
|
1027
|
+
r
|
1028
|
+
end
|
1029
|
+
end
|
1030
|
+
end
|
1031
|
+
|
1032
|
+
# Methods that turn an association that returns multiple objects into an association that
|
1033
|
+
# returns a single object.
|
1034
|
+
module SingularAssociationReflection
|
1035
|
+
# Singular associations do not assign singular if they are using the ruby eager limit strategy
|
1036
|
+
# and have a slice range, since they need to store the array of associated objects in order to
|
1037
|
+
# pick the correct one with an offset.
|
1038
|
+
def assign_singular?
|
1039
|
+
super && (eager_limit_strategy != :ruby || !slice_range)
|
1040
|
+
end
|
1041
|
+
|
1042
|
+
# Add conditions when filtering by singular associations with orders, since the
|
1043
|
+
# underlying relationship is probably not one-to-one.
|
1044
|
+
def filter_by_associations_add_conditions?
|
1045
|
+
super || self[:order] || self[:eager_limit_strategy] || self[:filter_limit_strategy]
|
1046
|
+
end
|
1047
|
+
|
1048
|
+
# Make sure singular associations always have 1 as the limit
|
1049
|
+
def limit_and_offset
|
1050
|
+
r = super
|
1051
|
+
if r.first == 1
|
1052
|
+
r
|
1053
|
+
else
|
1054
|
+
[1, r[1]]
|
1055
|
+
end
|
1056
|
+
end
|
1057
|
+
|
1058
|
+
# Singular associations always return a single object, not an array.
|
1059
|
+
def returns_array?
|
1060
|
+
false
|
1061
|
+
end
|
1062
|
+
|
1063
|
+
private
|
1064
|
+
|
1065
|
+
# Only use a eager limit strategy by default if there is an offset or an order.
|
1066
|
+
def default_eager_limit_strategy
|
1067
|
+
super if self[:order] || offset
|
1068
|
+
end
|
1069
|
+
|
1070
|
+
# Use a strategy for filtering by associations if there is an order or an offset,
|
1071
|
+
# or a specific limiting strategy has been specified.
|
1072
|
+
def filter_by_associations_limit_strategy
|
1073
|
+
super if self[:order] || offset || self[:eager_limit_strategy] || self[:filter_limit_strategy]
|
1074
|
+
end
|
1075
|
+
|
1076
|
+
# Use the DISTINCT ON eager limit strategy for true if the database supports it.
|
1077
|
+
def true_eager_graph_limit_strategy
|
1078
|
+
if associated_class.dataset.supports_ordered_distinct_on? && !offset
|
1079
|
+
:distinct_on
|
1080
|
+
else
|
1081
|
+
super
|
1082
|
+
end
|
1083
|
+
end
|
1084
|
+
end
|
1085
|
+
|
1086
|
+
class OneToOneAssociationReflection < OneToManyAssociationReflection
|
1087
|
+
ASSOCIATION_TYPES[:one_to_one] = self
|
1088
|
+
include SingularAssociationReflection
|
1089
|
+
end
|
1090
|
+
|
1091
|
+
class ManyToManyAssociationReflection < AssociationReflection
|
1092
|
+
ASSOCIATION_TYPES[:many_to_many] = self
|
1093
|
+
|
1094
|
+
# The alias to use for the associated key when eagerly loading
|
1095
|
+
def associated_key_alias
|
1096
|
+
self[:left_key_alias]
|
1097
|
+
end
|
1098
|
+
|
1099
|
+
# Array of associated keys used when eagerly loading.
|
1100
|
+
def associated_key_array
|
1101
|
+
cached_fetch(:associated_key_array) do
|
1102
|
+
if self[:uses_left_composite_keys]
|
1103
|
+
associated_key_alias.zip(predicate_keys).map{|a, k| SQL::AliasedExpression.new(k, a)}
|
1104
|
+
else
|
1105
|
+
[SQL::AliasedExpression.new(predicate_key, associated_key_alias)]
|
1106
|
+
end
|
1107
|
+
end
|
1108
|
+
end
|
1109
|
+
|
1110
|
+
# The column to use for the associated key when eagerly loading
|
1111
|
+
def associated_key_column
|
1112
|
+
self[:left_key]
|
1113
|
+
end
|
1114
|
+
|
1115
|
+
# Alias of right_primary_keys
|
1116
|
+
def associated_object_keys
|
1117
|
+
right_primary_keys
|
1118
|
+
end
|
1119
|
+
|
1120
|
+
# many_to_many associations can only have associated objects if none of
|
1121
|
+
# the :left_primary_keys options have a nil value.
|
1122
|
+
def can_have_associated_objects?(obj)
|
1123
|
+
!self[:left_primary_keys].any?{|k| obj.send(k).nil?}
|
1124
|
+
end
|
1125
|
+
|
1126
|
+
# one_through_one and many_to_many associations can be clones
|
1127
|
+
def cloneable?(ref)
|
1128
|
+
ref[:type] == :many_to_many || ref[:type] == :one_through_one
|
1129
|
+
end
|
1130
|
+
|
1131
|
+
# The default associated key alias(es) to use when eager loading
|
1132
|
+
# associations via eager.
|
1133
|
+
def default_associated_key_alias
|
1134
|
+
self[:uses_left_composite_keys] ? (0...self[:left_keys].length).map{|i| :"x_foreign_key_#{i}_x"} : :x_foreign_key_x
|
1135
|
+
end
|
1136
|
+
|
1137
|
+
# The default eager loader used if the user doesn't override it. Extracted
|
1138
|
+
# to a method so the code can be shared with the many_through_many plugin.
|
1139
|
+
def default_eager_loader(eo)
|
1140
|
+
h = eo[:id_map]
|
1141
|
+
assign_singular = assign_singular?
|
1142
|
+
delete_rn = delete_row_number_column
|
1143
|
+
uses_lcks = self[:uses_left_composite_keys]
|
1144
|
+
left_key_alias = self[:left_key_alias]
|
1145
|
+
name = self[:name]
|
1146
|
+
|
1147
|
+
self[:model].eager_load_results(self, eo) do |assoc_record|
|
1148
|
+
assoc_record.values.delete(delete_rn) if delete_rn
|
1149
|
+
hash_key = if uses_lcks
|
1150
|
+
left_key_alias.map{|k| assoc_record.values.delete(k)}
|
1151
|
+
else
|
1152
|
+
assoc_record.values.delete(left_key_alias)
|
1153
|
+
end
|
1154
|
+
next unless objects = h[hash_key]
|
1155
|
+
if assign_singular
|
1156
|
+
objects.each do |object|
|
1157
|
+
object.associations[name] ||= assoc_record
|
1158
|
+
end
|
1159
|
+
else
|
1160
|
+
objects.each do |object|
|
1161
|
+
object.associations[name].push(assoc_record)
|
1162
|
+
end
|
1163
|
+
end
|
1164
|
+
end
|
1165
|
+
end
|
1166
|
+
|
1167
|
+
# Default name symbol for the join table.
|
1168
|
+
def default_join_table
|
1169
|
+
[self[:class_name], self[:model].name].map{|i| underscore(pluralize(demodulize(i)))}.sort.join('_').to_sym
|
1170
|
+
end
|
1171
|
+
|
1172
|
+
# Default foreign key name symbol for key in join table that points to
|
1173
|
+
# current table's primary key (or :left_primary_key column).
|
1174
|
+
def default_left_key
|
1175
|
+
:"#{underscore(demodulize(self[:model].name))}_id"
|
1176
|
+
end
|
1177
|
+
|
1178
|
+
# Default foreign key name symbol for foreign key in join table that points to
|
1179
|
+
# the association's table's primary key (or :right_primary_key column).
|
1180
|
+
def default_right_key
|
1181
|
+
:"#{singularize(self[:name])}_id"
|
1182
|
+
end
|
1183
|
+
|
1184
|
+
# The hash key to use for the eager loading predicate (left side of IN (1, 2, 3)).
|
1185
|
+
# The left key qualified by the join table.
|
1186
|
+
def predicate_key
|
1187
|
+
cached_fetch(:predicate_key){qualify(join_table_alias, self[:left_key])}
|
1188
|
+
end
|
1189
|
+
alias qualified_left_key predicate_key
|
1190
|
+
|
1191
|
+
# The right key qualified by the join table.
|
1192
|
+
def qualified_right_key
|
1193
|
+
cached_fetch(:qualified_right_key){qualify(join_table_alias, self[:right_key])}
|
1194
|
+
end
|
1195
|
+
|
1196
|
+
# many_to_many associations need to select a key in an associated table to eagerly load
|
1197
|
+
def eager_loading_use_associated_key?
|
1198
|
+
true
|
1199
|
+
end
|
1200
|
+
|
1201
|
+
# The source of the join table. This is the join table itself, unless it
|
1202
|
+
# is aliased, in which case it is the unaliased part.
|
1203
|
+
def join_table_source
|
1204
|
+
cached_fetch(:join_table_source){split_join_table_alias[0]}
|
1205
|
+
end
|
1206
|
+
|
1207
|
+
# The join table itself, unless it is aliased, in which case this
|
1208
|
+
# is the alias.
|
1209
|
+
def join_table_alias
|
1210
|
+
cached_fetch(:join_table_alias) do
|
1211
|
+
s, a = split_join_table_alias
|
1212
|
+
a || s
|
1213
|
+
end
|
1214
|
+
end
|
1215
|
+
alias associated_key_table join_table_alias
|
1216
|
+
|
1217
|
+
# Whether the associated object needs a primary key to be added/removed,
|
1218
|
+
# true for many_to_many associations.
|
1219
|
+
def need_associated_primary_key?
|
1220
|
+
true
|
1221
|
+
end
|
1222
|
+
|
1223
|
+
# #right_primary_key qualified by the associated table
|
1224
|
+
def qualified_right_primary_key
|
1225
|
+
cached_fetch(:qualified_right_primary_key){qualify_assoc(right_primary_key)}
|
1226
|
+
end
|
1227
|
+
|
1228
|
+
# The primary key column(s) to use in the associated table (can be symbol or array).
|
1229
|
+
def right_primary_key
|
1230
|
+
cached_fetch(:right_primary_key){associated_class.primary_key || raise(Error, "no primary key specified for #{associated_class.inspect}")}
|
1231
|
+
end
|
1232
|
+
|
1233
|
+
# The primary key columns to use in the associated table (always array).
|
1234
|
+
def right_primary_keys
|
1235
|
+
cached_fetch(:right_primary_keys){Array(right_primary_key)}
|
1236
|
+
end
|
1237
|
+
|
1238
|
+
# The method symbol or array of method symbols to call on the associated objects
|
1239
|
+
# to get the foreign key values for the join table.
|
1240
|
+
def right_primary_key_method
|
1241
|
+
cached_fetch(:right_primary_key_method){right_primary_key}
|
1242
|
+
end
|
1243
|
+
|
1244
|
+
# The array of method symbols to call on the associated objects
|
1245
|
+
# to get the foreign key values for the join table.
|
1246
|
+
def right_primary_key_methods
|
1247
|
+
cached_fetch(:right_primary_key_methods){Array(right_primary_key_method)}
|
1248
|
+
end
|
1249
|
+
|
1250
|
+
# The columns to select when loading the association, associated_class.table_name.* by default.
|
1251
|
+
def select
|
1252
|
+
cached_fetch(:select){default_select}
|
1253
|
+
end
|
1254
|
+
|
1255
|
+
private
|
1256
|
+
|
1257
|
+
def _associated_dataset
|
1258
|
+
super.inner_join(self[:join_table], self[:right_keys].zip(right_primary_keys), :qualify=>:deep)
|
1259
|
+
end
|
1260
|
+
|
1261
|
+
# The default selection for associations that require joins. These do not use the default
|
1262
|
+
# model selection unless all entries in the select are explicitly qualified identifiers, as
|
1263
|
+
# other it can include unqualified columns which would be made ambiguous by joining.
|
1264
|
+
def default_select
|
1265
|
+
if (sel = associated_class.dataset.opts[:select]) && sel.all?{|c| selection_is_qualified?(c)}
|
1266
|
+
sel
|
1267
|
+
else
|
1268
|
+
Sequel::SQL::ColumnAll.new(associated_class.table_name)
|
1269
|
+
end
|
1270
|
+
end
|
1271
|
+
|
1272
|
+
def filter_by_associations_conditions_associated_keys
|
1273
|
+
qualify(join_table_alias, self[:left_keys])
|
1274
|
+
end
|
1275
|
+
|
1276
|
+
def filter_by_associations_conditions_key
|
1277
|
+
qualify(self[:model].table_name, self[:left_primary_key_column])
|
1278
|
+
end
|
1279
|
+
|
1280
|
+
def filter_by_associations_limit_alias_key
|
1281
|
+
aliaz = 'a'
|
1282
|
+
filter_by_associations_limit_key.map{|c| c.as(Sequel.identifier(aliaz = aliaz.next))}
|
1283
|
+
end
|
1284
|
+
|
1285
|
+
def filter_by_associations_limit_aliases
|
1286
|
+
filter_by_associations_limit_alias_key.map{|v| v.alias}
|
1287
|
+
end
|
1288
|
+
|
1289
|
+
def filter_by_associations_limit_key
|
1290
|
+
qualify(join_table_alias, self[:left_keys]) + Array(qualify(associated_class.table_name, associated_class.primary_key))
|
1291
|
+
end
|
1292
|
+
|
1293
|
+
def predicate_key_methods
|
1294
|
+
self[:left_primary_keys]
|
1295
|
+
end
|
1296
|
+
|
1297
|
+
def reciprocal_association?(assoc_reflect)
|
1298
|
+
super && assoc_reflect[:left_keys] == self[:right_keys] &&
|
1299
|
+
assoc_reflect[:right_keys] == self[:left_keys] &&
|
1300
|
+
assoc_reflect[:join_table] == self[:join_table] &&
|
1301
|
+
right_primary_keys == assoc_reflect[:left_primary_key_columns] &&
|
1302
|
+
self[:left_primary_key_columns] == assoc_reflect.right_primary_keys
|
1303
|
+
end
|
1304
|
+
|
1305
|
+
def reciprocal_type
|
1306
|
+
:many_to_many
|
1307
|
+
end
|
1308
|
+
|
1309
|
+
# Whether the given expression represents a qualified identifier. Used to determine if it is
|
1310
|
+
# OK to use directly when joining.
|
1311
|
+
def selection_is_qualified?(c)
|
1312
|
+
case c
|
1313
|
+
when Symbol
|
1314
|
+
Sequel.split_symbol(c)[0]
|
1315
|
+
when Sequel::SQL::QualifiedIdentifier
|
1316
|
+
true
|
1317
|
+
when Sequel::SQL::AliasedExpression
|
1318
|
+
selection_is_qualified?(c.expression)
|
1319
|
+
else
|
1320
|
+
false
|
1321
|
+
end
|
1322
|
+
end
|
1323
|
+
|
1324
|
+
# Split the join table into source and alias parts.
|
1325
|
+
def split_join_table_alias
|
1326
|
+
associated_class.dataset.split_alias(self[:join_table])
|
1327
|
+
end
|
1328
|
+
end
|
1329
|
+
|
1330
|
+
class OneThroughOneAssociationReflection < ManyToManyAssociationReflection
|
1331
|
+
ASSOCIATION_TYPES[:one_through_one] = self
|
1332
|
+
include SingularAssociationReflection
|
1333
|
+
|
1334
|
+
# one_through_one associations should not singularize the association name when
|
1335
|
+
# creating the foreign key.
|
1336
|
+
def default_right_key
|
1337
|
+
:"#{self[:name]}_id"
|
1338
|
+
end
|
1339
|
+
|
1340
|
+
# one_through_one associations have no reciprocals
|
1341
|
+
def reciprocal
|
1342
|
+
nil
|
1343
|
+
end
|
1344
|
+
end
|
1345
|
+
|
1346
|
+
# This module contains methods added to all association datasets
|
1347
|
+
module AssociationDatasetMethods
|
1348
|
+
# The model object that created the association dataset
|
1349
|
+
attr_accessor :model_object
|
1350
|
+
|
1351
|
+
# The association reflection related to the association dataset
|
1352
|
+
attr_accessor :association_reflection
|
1353
|
+
end
|
1354
|
+
|
1355
|
+
# Each kind of association adds a number of instance methods to the model class which
|
1356
|
+
# are specialized according to the association type and optional parameters
|
1357
|
+
# given in the definition. Example:
|
1358
|
+
#
|
1359
|
+
# class Project < Sequel::Model
|
1360
|
+
# many_to_one :portfolio
|
1361
|
+
# # or: one_to_one :portfolio
|
1362
|
+
# one_to_many :milestones
|
1363
|
+
# # or: many_to_many :milestones
|
1364
|
+
# end
|
1365
|
+
#
|
1366
|
+
# The project class now has the following instance methods:
|
1367
|
+
# portfolio :: Returns the associated portfolio.
|
1368
|
+
# portfolio=(obj) :: Sets the associated portfolio to the object,
|
1369
|
+
# but the change is not persisted until you save the record (for many_to_one associations).
|
1370
|
+
# portfolio_dataset :: Returns a dataset that would return the associated
|
1371
|
+
# portfolio, only useful in fairly specific circumstances.
|
1372
|
+
# milestones :: Returns an array of associated milestones
|
1373
|
+
# add_milestone(obj) :: Associates the passed milestone with this object.
|
1374
|
+
# remove_milestone(obj) :: Removes the association with the passed milestone.
|
1375
|
+
# remove_all_milestones :: Removes associations with all associated milestones.
|
1376
|
+
# milestones_dataset :: Returns a dataset that would return the associated
|
1377
|
+
# milestones, allowing for further filtering/limiting/etc.
|
1378
|
+
#
|
1379
|
+
# If you want to override the behavior of the add_/remove_/remove_all_/ methods
|
1380
|
+
# or the association setter method, use the :adder, :remover, :clearer, and/or :setter
|
1381
|
+
# options. These options override the default behavior.
|
1382
|
+
#
|
1383
|
+
# By default the classes for the associations are inferred from the association
|
1384
|
+
# name, so for example the Project#portfolio will return an instance of
|
1385
|
+
# Portfolio, and Project#milestones will return an array of Milestone
|
1386
|
+
# instances. You can use the :class option to change which class is used.
|
1387
|
+
#
|
1388
|
+
# Association definitions are also reflected by the class, e.g.:
|
1389
|
+
#
|
1390
|
+
# Project.associations
|
1391
|
+
# => [:portfolio, :milestones]
|
1392
|
+
# Project.association_reflection(:portfolio)
|
1393
|
+
# => {:type => :many_to_one, :name => :portfolio, ...}
|
1394
|
+
#
|
1395
|
+
# Associations should not have the same names as any of the columns in the
|
1396
|
+
# model's current table they reference. If you are dealing with an existing schema that
|
1397
|
+
# has a column named status, you can't name the association status, you'd
|
1398
|
+
# have to name it foo_status or something else. If you give an association the same name
|
1399
|
+
# as a column, you will probably end up with an association that doesn't work, or a SystemStackError.
|
1400
|
+
#
|
1401
|
+
# For a more in depth general overview, as well as a reference guide,
|
1402
|
+
# see the {Association Basics guide}[rdoc-ref:doc/association_basics.rdoc].
|
1403
|
+
# For examples of advanced usage, see the {Advanced Associations guide}[rdoc-ref:doc/advanced_associations.rdoc].
|
1404
|
+
module ClassMethods
|
1405
|
+
# All association reflections defined for this model (default: {}).
|
1406
|
+
attr_reader :association_reflections
|
1407
|
+
|
1408
|
+
# Hash with column symbol keys and arrays of many_to_one
|
1409
|
+
# association symbols that should be cleared when the column
|
1410
|
+
# value changes.
|
1411
|
+
attr_reader :autoreloading_associations
|
1412
|
+
|
1413
|
+
# Whether association metadata should be cached in the association reflection. If not cached, it will be computed
|
1414
|
+
# on demand. In general you only want to set this to default when using code reloading. When using code reloading,
|
1415
|
+
# setting this will make sure that if an associated class is removed or modified, this class will not hang on to
|
1416
|
+
# the previous class.
|
1417
|
+
attr_accessor :cache_associations
|
1418
|
+
|
1419
|
+
# The default :eager_limit_strategy option to use for limited or offset associations (default: true, causing Sequel
|
1420
|
+
# to use what it considers the most appropriate strategy).
|
1421
|
+
attr_accessor :default_eager_limit_strategy
|
1422
|
+
|
1423
|
+
# Array of all association reflections for this model class
|
1424
|
+
def all_association_reflections
|
1425
|
+
association_reflections.values
|
1426
|
+
end
|
1427
|
+
|
1428
|
+
# Associates a related model with the current model. The following types are
|
1429
|
+
# supported:
|
1430
|
+
#
|
1431
|
+
# :many_to_one :: Foreign key in current model's table points to
|
1432
|
+
# associated model's primary key. Each associated model object can
|
1433
|
+
# be associated with more than one current model objects. Each current
|
1434
|
+
# model object can be associated with only one associated model object.
|
1435
|
+
# :one_to_many :: Foreign key in associated model's table points to this
|
1436
|
+
# model's primary key. Each current model object can be associated with
|
1437
|
+
# more than one associated model objects. Each associated model object
|
1438
|
+
# can be associated with only one current model object.
|
1439
|
+
# :one_through_one :: Similar to many_to_many in terms of foreign keys, but only one object
|
1440
|
+
# is associated to the current object through the association.
|
1441
|
+
# Provides only getter methods, no setter or modification methods.
|
1442
|
+
# :one_to_one :: Similar to one_to_many in terms of foreign keys, but
|
1443
|
+
# only one object is associated to the current object through the
|
1444
|
+
# association. The methods created are similar to many_to_one, except
|
1445
|
+
# that the one_to_one setter method saves the passed object.
|
1446
|
+
# :many_to_many :: A join table is used that has a foreign key that points
|
1447
|
+
# to this model's primary key and a foreign key that points to the
|
1448
|
+
# associated model's primary key. Each current model object can be
|
1449
|
+
# associated with many associated model objects, and each associated
|
1450
|
+
# model object can be associated with many current model objects.
|
1451
|
+
#
|
1452
|
+
# The following options can be supplied:
|
1453
|
+
# === Multiple Types
|
1454
|
+
# :adder :: Proc used to define the private _add_* method for doing the database work
|
1455
|
+
# to associate the given object to the current object (*_to_many assocations).
|
1456
|
+
# :after_add :: Symbol, Proc, or array of both/either specifying a callback to call
|
1457
|
+
# after a new item is added to the association.
|
1458
|
+
# :after_load :: Symbol, Proc, or array of both/either specifying a callback to call
|
1459
|
+
# after the associated record(s) have been retrieved from the database.
|
1460
|
+
# :after_remove :: Symbol, Proc, or array of both/either specifying a callback to call
|
1461
|
+
# after an item is removed from the association.
|
1462
|
+
# :after_set :: Symbol, Proc, or array of both/either specifying a callback to call
|
1463
|
+
# after an item is set using the association setter method.
|
1464
|
+
# :allow_eager :: If set to false, you cannot load the association eagerly
|
1465
|
+
# via eager or eager_graph
|
1466
|
+
# :before_add :: Symbol, Proc, or array of both/either specifying a callback to call
|
1467
|
+
# before a new item is added to the association.
|
1468
|
+
# :before_remove :: Symbol, Proc, or array of both/either specifying a callback to call
|
1469
|
+
# before an item is removed from the association.
|
1470
|
+
# :before_set :: Symbol, Proc, or array of both/either specifying a callback to call
|
1471
|
+
# before an item is set using the association setter method.
|
1472
|
+
# :cartesian_product_number :: the number of joins completed by this association that could cause more
|
1473
|
+
# than one row for each row in the current table (default: 0 for
|
1474
|
+
# many_to_one, one_to_one, and one_through_one associations, 1
|
1475
|
+
# for one_to_many and many_to_many associations).
|
1476
|
+
# :class :: The associated class or its name as a string or symbol. If not
|
1477
|
+
# given, uses the association's name, which is camelized (and
|
1478
|
+
# singularized unless the type is :many_to_one, :one_to_one, or one_through_one). If this is specified
|
1479
|
+
# as a string or symbol, you must specify the full class name (e.g. "SomeModule::MyModel").
|
1480
|
+
# :clearer :: Proc used to define the private _remove_all_* method for doing the database work
|
1481
|
+
# to remove all objects associated to the current object (*_to_many assocations).
|
1482
|
+
# :clone :: Merge the current options and block into the options and block used in defining
|
1483
|
+
# the given association. Can be used to DRY up a bunch of similar associations that
|
1484
|
+
# all share the same options such as :class and :key, while changing the order and block used.
|
1485
|
+
# :conditions :: The conditions to use to filter the association, can be any argument passed to where.
|
1486
|
+
# :dataset :: A proc that is instance_execed to get the base dataset to use (before the other
|
1487
|
+
# options are applied). If the proc accepts an argument, it is passed the related
|
1488
|
+
# association reflection.
|
1489
|
+
# :distinct :: Use the DISTINCT clause when selecting associating object, both when
|
1490
|
+
# lazy loading and eager loading via .eager (but not when using .eager_graph).
|
1491
|
+
# :eager :: The associations to eagerly load via +eager+ when loading the associated object(s).
|
1492
|
+
# :eager_block :: If given, use the block instead of the default block when
|
1493
|
+
# eagerly loading. To not use a block when eager loading (when one is used normally),
|
1494
|
+
# set to nil.
|
1495
|
+
# :eager_graph :: The associations to eagerly load via +eager_graph+ when loading the associated object(s).
|
1496
|
+
# many_to_many associations with this option cannot be eagerly loaded via +eager+.
|
1497
|
+
# :eager_grapher :: A proc to use to implement eager loading via +eager_graph+, overriding the default.
|
1498
|
+
# Takes an options hash with at least the entries :self (the receiver of the eager_graph call),
|
1499
|
+
# :table_alias (the alias to use for table to graph into the association), and :implicit_qualifier
|
1500
|
+
# (the alias that was used for the current table).
|
1501
|
+
# Should return a copy of the dataset with the association graphed into it.
|
1502
|
+
# :eager_limit_strategy :: Determines the strategy used for enforcing limits and offsets when eager loading
|
1503
|
+
# associations via the +eager+ method.
|
1504
|
+
# :eager_loader :: A proc to use to implement eager loading, overriding the default. Takes a single hash argument,
|
1505
|
+
# with at least the keys: :rows, which is an array of current model instances, :associations,
|
1506
|
+
# which is a hash of dependent associations, :self, which is the dataset doing the eager loading,
|
1507
|
+
# :eager_block, which is a dynamic callback that should be called with the dataset, and :id_map,
|
1508
|
+
# which is a mapping of key values to arrays of current model instances. In the proc, the
|
1509
|
+
# associated records should be queried from the database and the associations cache for each
|
1510
|
+
# record should be populated.
|
1511
|
+
# :eager_loader_key :: A symbol for the key column to use to populate the key_hash
|
1512
|
+
# for the eager loader. Can be set to nil to not populate the key_hash.
|
1513
|
+
# :extend :: A module or array of modules to extend the dataset with.
|
1514
|
+
# :filter_limit_strategy :: Determines the strategy used for enforcing limits and offsets when filtering by
|
1515
|
+
# limited associations. Possible options are :window_function, :distinct_on, or
|
1516
|
+
# :correlated_subquery depending on association type and database type.
|
1517
|
+
# :graph_alias_base :: The base name to use for the table alias when eager graphing. Defaults to the name
|
1518
|
+
# of the association. If the alias name has already been used in the query, Sequel will create
|
1519
|
+
# a unique alias by appending a numeric suffix (e.g. alias_0, alias_1, ...) until the alias is
|
1520
|
+
# unique.
|
1521
|
+
# :graph_block :: The block to pass to join_table when eagerly loading
|
1522
|
+
# the association via +eager_graph+.
|
1523
|
+
# :graph_conditions :: The additional conditions to use on the SQL join when eagerly loading
|
1524
|
+
# the association via +eager_graph+. Should be a hash or an array of two element arrays. If not
|
1525
|
+
# specified, the :conditions option is used if it is a hash or array of two element arrays.
|
1526
|
+
# :graph_join_type :: The type of SQL join to use when eagerly loading the association via
|
1527
|
+
# eager_graph. Defaults to :left_outer.
|
1528
|
+
# :graph_only_conditions :: The conditions to use on the SQL join when eagerly loading
|
1529
|
+
# the association via +eager_graph+, instead of the default conditions specified by the
|
1530
|
+
# foreign/primary keys. This option causes the :graph_conditions option to be ignored.
|
1531
|
+
# :graph_order :: Over the order to use when using eager_graph, instead of the default order. This should be used
|
1532
|
+
# in the case where :order contains an identifier qualified by the table's name, which may not match
|
1533
|
+
# the alias used when eager graphing. By setting this to the unqualified identifier, it will be
|
1534
|
+
# automatically qualified when using eager_graph.
|
1535
|
+
# :graph_select :: A column or array of columns to select from the associated table
|
1536
|
+
# when eagerly loading the association via +eager_graph+. Defaults to all
|
1537
|
+
# columns in the associated table.
|
1538
|
+
# :limit :: Limit the number of records to the provided value. Use
|
1539
|
+
# an array with two elements for the value to specify a
|
1540
|
+
# limit (first element) and an offset (second element).
|
1541
|
+
# :methods_module :: The module that methods the association creates will be placed into. Defaults
|
1542
|
+
# to the module containing the model's columns.
|
1543
|
+
# :order :: the column(s) by which to order the association dataset. Can be a
|
1544
|
+
# singular column symbol or an array of column symbols.
|
1545
|
+
# :order_eager_graph :: Whether to add the association's order to the graphed dataset's order when graphing
|
1546
|
+
# via +eager_graph+. Defaults to true, so set to false to disable.
|
1547
|
+
# :read_only :: Do not add a setter method (for many_to_one or one_to_one associations),
|
1548
|
+
# or add_/remove_/remove_all_ methods (for one_to_many and many_to_many associations). Always
|
1549
|
+
# true for one_through_one associations.
|
1550
|
+
# :reciprocal :: the symbol name of the reciprocal association,
|
1551
|
+
# if it exists. By default, Sequel will try to determine it by looking at the
|
1552
|
+
# associated model's assocations for a association that matches
|
1553
|
+
# the current association's key(s). Set to nil to not use a reciprocal.
|
1554
|
+
# :remover :: Proc used to define the private _remove_* method for doing the database work
|
1555
|
+
# to remove the association between the given object and the current object (*_to_many assocations).
|
1556
|
+
# :select :: the columns to select. Defaults to the associated class's table_name.* in an association
|
1557
|
+
# that uses joins, which means it doesn't include the attributes from the
|
1558
|
+
# join table. If you want to include the join table attributes, you can
|
1559
|
+
# use this option, but beware that the join table attributes can clash with
|
1560
|
+
# attributes from the model table, so you should alias any attributes that have
|
1561
|
+
# the same name in both the join table and the associated table.
|
1562
|
+
# :setter :: Proc used to define the private _*= method for doing the work to setup the assocation
|
1563
|
+
# between the given object and the current object (*_to_one associations).
|
1564
|
+
# :subqueries_per_union :: The number of subqueries to use in each UNION query, for eager
|
1565
|
+
# loading limited associations using the default :union strategy.
|
1566
|
+
# :validate :: Set to false to not validate when implicitly saving any associated object.
|
1567
|
+
# === :many_to_one
|
1568
|
+
# :key :: foreign key in current model's table that references
|
1569
|
+
# associated model's primary key, as a symbol. Defaults to :"#{name}_id". Can use an
|
1570
|
+
# array of symbols for a composite key association.
|
1571
|
+
# :key_column :: Similar to, and usually identical to, :key, but :key refers to the model method
|
1572
|
+
# to call, where :key_column refers to the underlying column. Should only be
|
1573
|
+
# used if the model method differs from the foreign key column, in conjunction
|
1574
|
+
# with defining a model alias method for the key column.
|
1575
|
+
# :primary_key :: column in the associated table that :key option references, as a symbol.
|
1576
|
+
# Defaults to the primary key of the associated table. Can use an
|
1577
|
+
# array of symbols for a composite key association.
|
1578
|
+
# :primary_key_method :: the method symbol or array of method symbols to call on the associated
|
1579
|
+
# object to get the foreign key values. Defaults to :primary_key option.
|
1580
|
+
# :qualify :: Whether to use qualifier primary keys when loading the association. The default
|
1581
|
+
# is true, so you must set to false to not qualify. Qualification rarely causes
|
1582
|
+
# problems, but it's necessary to disable in some cases, such as when you are doing
|
1583
|
+
# a JOIN USING operation on the column on Oracle.
|
1584
|
+
# === :one_to_many and :one_to_one
|
1585
|
+
# :key :: foreign key in associated model's table that references
|
1586
|
+
# current model's primary key, as a symbol. Defaults to
|
1587
|
+
# :"#{self.name.underscore}_id". Can use an
|
1588
|
+
# array of symbols for a composite key association.
|
1589
|
+
# :key_method :: the method symbol or array of method symbols to call on the associated
|
1590
|
+
# object to get the foreign key values. Defaults to :key option.
|
1591
|
+
# :primary_key :: column in the current table that :key option references, as a symbol.
|
1592
|
+
# Defaults to primary key of the current table. Can use an
|
1593
|
+
# array of symbols for a composite key association.
|
1594
|
+
# :primary_key_column :: Similar to, and usually identical to, :primary_key, but :primary_key refers
|
1595
|
+
# to the model method call, where :primary_key_column refers to the underlying column.
|
1596
|
+
# Should only be used if the model method differs from the primary key column, in
|
1597
|
+
# conjunction with defining a model alias method for the primary key column.
|
1598
|
+
# :raise_on_save_failure :: Do not raise exceptions for hook or validation failures when saving associated
|
1599
|
+
# objects in the add/remove methods (return nil instead) [one_to_many only].
|
1600
|
+
# === :many_to_many and :one_through_one
|
1601
|
+
# :graph_join_table_block :: The block to pass to +join_table+ for
|
1602
|
+
# the join table when eagerly loading the association via +eager_graph+.
|
1603
|
+
# :graph_join_table_conditions :: The additional conditions to use on the SQL join for
|
1604
|
+
# the join table when eagerly loading the association via +eager_graph+.
|
1605
|
+
# Should be a hash or an array of two element arrays.
|
1606
|
+
# :graph_join_table_join_type :: The type of SQL join to use for the join table when eagerly
|
1607
|
+
# loading the association via +eager_graph+. Defaults to the
|
1608
|
+
# :graph_join_type option or :left_outer.
|
1609
|
+
# :graph_join_table_only_conditions :: The conditions to use on the SQL join for the join
|
1610
|
+
# table when eagerly loading the association via +eager_graph+,
|
1611
|
+
# instead of the default conditions specified by the
|
1612
|
+
# foreign/primary keys. This option causes the
|
1613
|
+
# :graph_join_table_conditions option to be ignored.
|
1614
|
+
# :join_table :: name of table that includes the foreign keys to both
|
1615
|
+
# the current model and the associated model, as a symbol. Defaults to the name
|
1616
|
+
# of current model and name of associated model, pluralized,
|
1617
|
+
# underscored, sorted, and joined with '_'.
|
1618
|
+
# :join_table_block :: proc that can be used to modify the dataset used in the add/remove/remove_all
|
1619
|
+
# methods. Should accept a dataset argument and return a modified dataset if present.
|
1620
|
+
# :left_key :: foreign key in join table that points to current model's
|
1621
|
+
# primary key, as a symbol. Defaults to :"#{self.name.underscore}_id".
|
1622
|
+
# Can use an array of symbols for a composite key association.
|
1623
|
+
# :left_primary_key :: column in current table that :left_key points to, as a symbol.
|
1624
|
+
# Defaults to primary key of current table. Can use an
|
1625
|
+
# array of symbols for a composite key association.
|
1626
|
+
# :left_primary_key_column :: Similar to, and usually identical to, :left_primary_key, but :left_primary_key refers to
|
1627
|
+
# the model method to call, where :left_primary_key_column refers to the underlying column. Should only
|
1628
|
+
# be used if the model method differs from the left primary key column, in conjunction
|
1629
|
+
# with defining a model alias method for the left primary key column.
|
1630
|
+
# :right_key :: foreign key in join table that points to associated
|
1631
|
+
# model's primary key, as a symbol. Defaults to :"#{name.to_s.singularize}_id".
|
1632
|
+
# Can use an array of symbols for a composite key association.
|
1633
|
+
# :right_primary_key :: column in associated table that :right_key points to, as a symbol.
|
1634
|
+
# Defaults to primary key of the associated table. Can use an
|
1635
|
+
# array of symbols for a composite key association.
|
1636
|
+
# :right_primary_key_method :: the method symbol or array of method symbols to call on the associated
|
1637
|
+
# object to get the foreign key values for the join table.
|
1638
|
+
# Defaults to :right_primary_key option.
|
1639
|
+
# :uniq :: Adds a after_load callback that makes the array of objects unique.
|
1640
|
+
def associate(type, name, opts = OPTS, &block)
|
1641
|
+
raise(Error, 'invalid association type') unless assoc_class = ASSOCIATION_TYPES[type]
|
1642
|
+
raise(Error, 'Model.associate name argument must be a symbol') unless name.is_a?(Symbol)
|
1643
|
+
|
1644
|
+
# dup early so we don't modify opts
|
1645
|
+
orig_opts = opts.dup
|
1646
|
+
|
1647
|
+
if opts[:clone]
|
1648
|
+
cloned_assoc = association_reflection(opts[:clone])
|
1649
|
+
orig_opts = cloned_assoc[:orig_opts].merge(orig_opts)
|
1650
|
+
end
|
1651
|
+
|
1652
|
+
opts = orig_opts.merge(:type => type, :name => name, :cache=>({} if cache_associations), :model => self)
|
1653
|
+
opts[:block] = block if block
|
1654
|
+
if block || orig_opts[:block] || orig_opts[:dataset]
|
1655
|
+
# It's possible the association is instance specific, in that it depends on
|
1656
|
+
# values other than the foreign key value. This needs to be checked for
|
1657
|
+
# in certain places to disable optimizations.
|
1658
|
+
opts[:instance_specific] = true
|
1659
|
+
end
|
1660
|
+
opts = assoc_class.new.merge!(opts)
|
1661
|
+
|
1662
|
+
if opts[:clone] && !opts.cloneable?(cloned_assoc)
|
1663
|
+
raise(Error, "cannot clone an association to an association of different type (association #{name} with type #{type} cloning #{opts[:clone]} with type #{cloned_assoc[:type]})")
|
1664
|
+
end
|
1665
|
+
|
1666
|
+
opts[:eager_block] = opts[:block] unless opts.include?(:eager_block)
|
1667
|
+
if !opts.has_key?(:predicate_key) && opts.has_key?(:eager_loading_predicate_key)
|
1668
|
+
opts[:predicate_key] = opts[:eager_loading_predicate_key]
|
1669
|
+
end
|
1670
|
+
opts[:graph_join_type] ||= :left_outer
|
1671
|
+
opts[:order_eager_graph] = true unless opts.include?(:order_eager_graph)
|
1672
|
+
conds = opts[:conditions]
|
1673
|
+
opts[:graph_alias_base] ||= name
|
1674
|
+
opts[:graph_conditions] = conds if !opts.include?(:graph_conditions) and Sequel.condition_specifier?(conds)
|
1675
|
+
opts[:graph_conditions] = opts.fetch(:graph_conditions, []).to_a
|
1676
|
+
opts[:graph_select] = Array(opts[:graph_select]) if opts[:graph_select]
|
1677
|
+
[:before_add, :before_remove, :after_add, :after_remove, :after_load, :before_set, :after_set, :extend].each do |cb_type|
|
1678
|
+
opts[cb_type] = Array(opts[cb_type])
|
1679
|
+
end
|
1680
|
+
late_binding_class_option(opts, opts.returns_array? ? singularize(name) : name)
|
1681
|
+
|
1682
|
+
# Remove :class entry if it exists and is nil, to work with cached_fetch
|
1683
|
+
opts.delete(:class) unless opts[:class]
|
1684
|
+
|
1685
|
+
send(:"def_#{type}", opts)
|
1686
|
+
def_association_instance_methods(opts)
|
1687
|
+
|
1688
|
+
orig_opts.delete(:clone)
|
1689
|
+
orig_opts.merge!(:class_name=>opts[:class_name], :class=>opts[:class], :block=>opts[:block])
|
1690
|
+
opts[:orig_opts] = orig_opts
|
1691
|
+
# don't add to association_reflections until we are sure there are no errors
|
1692
|
+
association_reflections[name] = opts
|
1693
|
+
end
|
1694
|
+
|
1695
|
+
# The association reflection hash for the association of the given name.
|
1696
|
+
def association_reflection(name)
|
1697
|
+
association_reflections[name]
|
1698
|
+
end
|
1699
|
+
|
1700
|
+
# Array of association name symbols
|
1701
|
+
def associations
|
1702
|
+
association_reflections.keys
|
1703
|
+
end
|
1704
|
+
|
1705
|
+
# Eager load the association with the given eager loader options.
|
1706
|
+
def eager_load_results(opts, eo, &block)
|
1707
|
+
opts.eager_load_results(eo, &block)
|
1708
|
+
end
|
1709
|
+
|
1710
|
+
# Shortcut for adding a many_to_many association, see #associate
|
1711
|
+
def many_to_many(name, opts=OPTS, &block)
|
1712
|
+
associate(:many_to_many, name, opts, &block)
|
1713
|
+
end
|
1714
|
+
|
1715
|
+
# Shortcut for adding a many_to_one association, see #associate
|
1716
|
+
def many_to_one(name, opts=OPTS, &block)
|
1717
|
+
associate(:many_to_one, name, opts, &block)
|
1718
|
+
end
|
1719
|
+
|
1720
|
+
# Shortcut for adding a one_through_one association, see #associate.
|
1721
|
+
def one_through_one(name, opts=OPTS, &block)
|
1722
|
+
associate(:one_through_one, name, opts, &block)
|
1723
|
+
end
|
1724
|
+
|
1725
|
+
# Shortcut for adding a one_to_many association, see #associate
|
1726
|
+
def one_to_many(name, opts=OPTS, &block)
|
1727
|
+
associate(:one_to_many, name, opts, &block)
|
1728
|
+
end
|
1729
|
+
|
1730
|
+
# Shortcut for adding a one_to_one association, see #associate.
|
1731
|
+
def one_to_one(name, opts=OPTS, &block)
|
1732
|
+
associate(:one_to_one, name, opts, &block)
|
1733
|
+
end
|
1734
|
+
|
1735
|
+
Plugins.inherited_instance_variables(self, :@association_reflections=>:dup, :@autoreloading_associations=>:hash_dup, :@cache_associations=>nil, :@default_eager_limit_strategy=>nil)
|
1736
|
+
Plugins.def_dataset_methods(self, [:eager, :eager_graph, :eager_graph_with_options, :association_join, :association_full_join, :association_inner_join, :association_left_join, :association_right_join])
|
1737
|
+
|
1738
|
+
private
|
1739
|
+
|
1740
|
+
# The module to use for the association's methods. Defaults to
|
1741
|
+
# the overridable_methods_module.
|
1742
|
+
def association_module(opts=OPTS)
|
1743
|
+
opts.fetch(:methods_module, overridable_methods_module)
|
1744
|
+
end
|
1745
|
+
|
1746
|
+
# Add a method to the module included in the class, so the method
|
1747
|
+
# can be easily overridden in the class itself while allowing for
|
1748
|
+
# super to be called.
|
1749
|
+
def association_module_def(name, opts=OPTS, &block)
|
1750
|
+
association_module(opts).module_eval{define_method(name, &block)}
|
1751
|
+
end
|
1752
|
+
|
1753
|
+
# Add a private method to the module included in the class.
|
1754
|
+
def association_module_private_def(name, opts=OPTS, &block)
|
1755
|
+
association_module_def(name, opts, &block)
|
1756
|
+
association_module(opts).send(:private, name)
|
1757
|
+
end
|
1758
|
+
|
1759
|
+
# Adds the association method to the association methods module.
|
1760
|
+
def def_association_method(opts)
|
1761
|
+
association_module_def(opts.association_method, opts){|*dynamic_opts, &block| load_associated_objects(opts, dynamic_opts[0], &block)}
|
1762
|
+
end
|
1763
|
+
|
1764
|
+
# Define all of the association instance methods for this association.
|
1765
|
+
def def_association_instance_methods(opts)
|
1766
|
+
association_module_def(opts.dataset_method, opts){_dataset(opts)}
|
1767
|
+
def_association_method(opts)
|
1768
|
+
|
1769
|
+
return if opts[:read_only]
|
1770
|
+
|
1771
|
+
if opts[:setter] && opts[:_setter]
|
1772
|
+
# This is backwards due to backwards compatibility
|
1773
|
+
association_module_private_def(opts._setter_method, opts, &opts[:setter])
|
1774
|
+
association_module_def(opts.setter_method, opts, &opts[:_setter])
|
1775
|
+
end
|
1776
|
+
|
1777
|
+
if adder = opts[:adder]
|
1778
|
+
association_module_private_def(opts._add_method, opts, &adder)
|
1779
|
+
association_module_def(opts.add_method, opts){|o,*args| add_associated_object(opts, o, *args)}
|
1780
|
+
end
|
1781
|
+
|
1782
|
+
if remover = opts[:remover]
|
1783
|
+
association_module_private_def(opts._remove_method, opts, &remover)
|
1784
|
+
association_module_def(opts.remove_method, opts){|o,*args| remove_associated_object(opts, o, *args)}
|
1785
|
+
end
|
1786
|
+
|
1787
|
+
if clearer = opts[:clearer]
|
1788
|
+
association_module_private_def(opts._remove_all_method, opts, &clearer)
|
1789
|
+
association_module_def(opts.remove_all_method, opts){|*args| remove_all_associated_objects(opts, *args)}
|
1790
|
+
end
|
1791
|
+
end
|
1792
|
+
|
1793
|
+
# Configures many_to_many and one_through_one association reflection and adds the related association methods
|
1794
|
+
def def_many_to_many(opts)
|
1795
|
+
one_through_one = opts[:type] == :one_through_one
|
1796
|
+
opts[:read_only] = true if one_through_one
|
1797
|
+
left = (opts[:left_key] ||= opts.default_left_key)
|
1798
|
+
lcks = opts[:left_keys] = Array(left)
|
1799
|
+
right = (opts[:right_key] ||= opts.default_right_key)
|
1800
|
+
rcks = opts[:right_keys] = Array(right)
|
1801
|
+
left_pk = (opts[:left_primary_key] ||= self.primary_key)
|
1802
|
+
opts[:eager_loader_key] = left_pk unless opts.has_key?(:eager_loader_key)
|
1803
|
+
lcpks = opts[:left_primary_keys] = Array(left_pk)
|
1804
|
+
lpkc = opts[:left_primary_key_column] ||= left_pk
|
1805
|
+
lpkcs = opts[:left_primary_key_columns] ||= Array(lpkc)
|
1806
|
+
raise(Error, "mismatched number of left keys: #{lcks.inspect} vs #{lcpks.inspect}") unless lcks.length == lcpks.length
|
1807
|
+
if opts[:right_primary_key]
|
1808
|
+
rcpks = Array(opts[:right_primary_key])
|
1809
|
+
raise(Error, "mismatched number of right keys: #{rcks.inspect} vs #{rcpks.inspect}") unless rcks.length == rcpks.length
|
1810
|
+
end
|
1811
|
+
opts[:uses_left_composite_keys] = lcks.length > 1
|
1812
|
+
opts[:uses_right_composite_keys] = rcks.length > 1
|
1813
|
+
opts[:cartesian_product_number] ||= one_through_one ? 0 : 1
|
1814
|
+
join_table = (opts[:join_table] ||= opts.default_join_table)
|
1815
|
+
opts[:left_key_alias] ||= opts.default_associated_key_alias
|
1816
|
+
opts[:graph_join_table_join_type] ||= opts[:graph_join_type]
|
1817
|
+
opts[:after_load].unshift(:array_uniq!) if opts[:uniq]
|
1818
|
+
opts[:dataset] ||= opts.association_dataset_proc
|
1819
|
+
opts[:eager_loader] ||= opts.method(:default_eager_loader)
|
1820
|
+
|
1821
|
+
join_type = opts[:graph_join_type]
|
1822
|
+
select = opts[:graph_select]
|
1823
|
+
use_only_conditions = opts.include?(:graph_only_conditions)
|
1824
|
+
only_conditions = opts[:graph_only_conditions]
|
1825
|
+
conditions = opts[:graph_conditions]
|
1826
|
+
graph_block = opts[:graph_block]
|
1827
|
+
graph_jt_conds = opts[:graph_join_table_conditions] = opts.fetch(:graph_join_table_conditions, []).to_a
|
1828
|
+
use_jt_only_conditions = opts.include?(:graph_join_table_only_conditions)
|
1829
|
+
jt_only_conditions = opts[:graph_join_table_only_conditions]
|
1830
|
+
jt_join_type = opts[:graph_join_table_join_type]
|
1831
|
+
jt_graph_block = opts[:graph_join_table_block]
|
1832
|
+
opts[:eager_grapher] ||= proc do |eo|
|
1833
|
+
ds = eo[:self]
|
1834
|
+
egls = eo[:limit_strategy]
|
1835
|
+
if egls && egls != :ruby
|
1836
|
+
associated_key_array = opts.associated_key_array
|
1837
|
+
orig_egds = egds = eager_graph_dataset(opts, eo)
|
1838
|
+
egds = egds.
|
1839
|
+
inner_join(join_table, rcks.zip(opts.right_primary_keys) + graph_jt_conds, :qualify=>:deep).
|
1840
|
+
select_all(egds.first_source).
|
1841
|
+
select_append(*associated_key_array)
|
1842
|
+
egds = opts.apply_eager_graph_limit_strategy(egls, egds)
|
1843
|
+
ds.graph(egds, associated_key_array.map{|v| v.alias}.zip(lpkcs) + conditions, :qualify=>:deep, :table_alias=>eo[:table_alias], :implicit_qualifier=>eo[:implicit_qualifier], :join_type=>eo[:join_type]||join_type, :from_self_alias=>eo[:from_self_alias], :join_only=>eo[:join_only], :select=>select||orig_egds.columns, &graph_block)
|
1844
|
+
else
|
1845
|
+
ds = ds.graph(join_table, use_jt_only_conditions ? jt_only_conditions : lcks.zip(lpkcs) + graph_jt_conds, :select=>false, :table_alias=>ds.unused_table_alias(join_table, [eo[:table_alias]]), :join_type=>eo[:join_type]||jt_join_type, :join_only=>eo[:join_only], :implicit_qualifier=>eo[:implicit_qualifier], :qualify=>:deep, :from_self_alias=>eo[:from_self_alias], &jt_graph_block)
|
1846
|
+
ds.graph(eager_graph_dataset(opts, eo), use_only_conditions ? only_conditions : opts.right_primary_keys.zip(rcks) + conditions, :select=>select, :table_alias=>eo[:table_alias], :qualify=>:deep, :join_type=>eo[:join_type]||join_type, :join_only=>eo[:join_only], &graph_block)
|
1847
|
+
end
|
1848
|
+
end
|
1849
|
+
|
1850
|
+
return if opts[:read_only] || one_through_one
|
1851
|
+
|
1852
|
+
opts[:adder] ||= proc do |o|
|
1853
|
+
h = {}
|
1854
|
+
lcks.zip(lcpks).each{|k, pk| h[k] = send(pk)}
|
1855
|
+
rcks.zip(opts.right_primary_key_methods).each{|k, pk| h[k] = o.send(pk)}
|
1856
|
+
_join_table_dataset(opts).insert(h)
|
1857
|
+
end
|
1858
|
+
|
1859
|
+
opts[:remover] ||= proc do |o|
|
1860
|
+
_join_table_dataset(opts).where(lcks.zip(lcpks.map{|k| send(k)}) + rcks.zip(opts.right_primary_key_methods.map{|k| o.send(k)})).delete
|
1861
|
+
end
|
1862
|
+
|
1863
|
+
opts[:clearer] ||= proc do
|
1864
|
+
_join_table_dataset(opts).where(lcks.zip(lcpks.map{|k| send(k)})).delete
|
1865
|
+
end
|
1866
|
+
end
|
1867
|
+
|
1868
|
+
# Configures many_to_one association reflection and adds the related association methods
|
1869
|
+
def def_many_to_one(opts)
|
1870
|
+
name = opts[:name]
|
1871
|
+
opts[:key] = opts.default_key unless opts.has_key?(:key)
|
1872
|
+
key = opts[:key]
|
1873
|
+
opts[:eager_loader_key] = key unless opts.has_key?(:eager_loader_key)
|
1874
|
+
cks = opts[:graph_keys] = opts[:keys] = Array(key)
|
1875
|
+
opts[:key_column] ||= key
|
1876
|
+
opts[:graph_keys] = opts[:key_columns] = Array(opts[:key_column])
|
1877
|
+
opts[:qualified_key] = opts.qualify_cur(key)
|
1878
|
+
if opts[:primary_key]
|
1879
|
+
cpks = Array(opts[:primary_key])
|
1880
|
+
raise(Error, "mismatched number of keys: #{cks.inspect} vs #{cpks.inspect}") unless cks.length == cpks.length
|
1881
|
+
end
|
1882
|
+
uses_cks = opts[:uses_composite_keys] = cks.length > 1
|
1883
|
+
opts[:cartesian_product_number] ||= 0
|
1884
|
+
|
1885
|
+
if !opts.has_key?(:many_to_one_pk_lookup) &&
|
1886
|
+
(opts[:dataset] || opts[:conditions] || opts[:block] || opts[:select] ||
|
1887
|
+
(opts.has_key?(:key) && opts[:key] == nil))
|
1888
|
+
opts[:many_to_one_pk_lookup] = false
|
1889
|
+
end
|
1890
|
+
auto_assocs = @autoreloading_associations
|
1891
|
+
cks.each do |k|
|
1892
|
+
(auto_assocs[k] ||= []) << name
|
1893
|
+
end
|
1894
|
+
|
1895
|
+
opts[:dataset] ||= opts.association_dataset_proc
|
1896
|
+
opts[:eager_loader] ||= proc do |eo|
|
1897
|
+
h = eo[:id_map]
|
1898
|
+
pk_meths = opts.primary_key_methods
|
1899
|
+
|
1900
|
+
eager_load_results(opts, eo) do |assoc_record|
|
1901
|
+
hash_key = uses_cks ? pk_meths.map{|k| assoc_record.send(k)} : assoc_record.send(opts.primary_key_method)
|
1902
|
+
if objects = h[hash_key]
|
1903
|
+
objects.each{|object| object.associations[name] = assoc_record}
|
1904
|
+
end
|
1905
|
+
end
|
1906
|
+
end
|
1907
|
+
|
1908
|
+
join_type = opts[:graph_join_type]
|
1909
|
+
select = opts[:graph_select]
|
1910
|
+
use_only_conditions = opts.include?(:graph_only_conditions)
|
1911
|
+
only_conditions = opts[:graph_only_conditions]
|
1912
|
+
conditions = opts[:graph_conditions]
|
1913
|
+
graph_block = opts[:graph_block]
|
1914
|
+
graph_cks = opts[:graph_keys]
|
1915
|
+
opts[:eager_grapher] ||= proc do |eo|
|
1916
|
+
ds = eo[:self]
|
1917
|
+
ds.graph(eager_graph_dataset(opts, eo), use_only_conditions ? only_conditions : opts.primary_keys.zip(graph_cks) + conditions, eo.merge(:select=>select, :join_type=>eo[:join_type]||join_type, :qualify=>:deep, :from_self_alias=>eo[:from_self_alias]), &graph_block)
|
1918
|
+
end
|
1919
|
+
|
1920
|
+
return if opts[:read_only]
|
1921
|
+
|
1922
|
+
opts[:setter] ||= proc{|o| cks.zip(opts.primary_key_methods).each{|k, pk| send(:"#{k}=", (o.send(pk) if o))}}
|
1923
|
+
opts[:_setter] = proc{|o| set_associated_object(opts, o)}
|
1924
|
+
end
|
1925
|
+
|
1926
|
+
# Configures one_to_many and one_to_one association reflections and adds the related association methods
|
1927
|
+
def def_one_to_many(opts)
|
1928
|
+
one_to_one = opts[:type] == :one_to_one
|
1929
|
+
name = opts[:name]
|
1930
|
+
key = (opts[:key] ||= opts.default_key)
|
1931
|
+
km = opts[:key_method] ||= opts[:key]
|
1932
|
+
cks = opts[:keys] = Array(key)
|
1933
|
+
opts[:key_methods] = Array(opts[:key_method])
|
1934
|
+
primary_key = (opts[:primary_key] ||= self.primary_key)
|
1935
|
+
opts[:eager_loader_key] = primary_key unless opts.has_key?(:eager_loader_key)
|
1936
|
+
cpks = opts[:primary_keys] = Array(primary_key)
|
1937
|
+
pkc = opts[:primary_key_column] ||= primary_key
|
1938
|
+
pkcs = opts[:primary_key_columns] ||= Array(pkc)
|
1939
|
+
raise(Error, "mismatched number of keys: #{cks.inspect} vs #{cpks.inspect}") unless cks.length == cpks.length
|
1940
|
+
uses_cks = opts[:uses_composite_keys] = cks.length > 1
|
1941
|
+
opts[:dataset] ||= opts.association_dataset_proc
|
1942
|
+
opts[:eager_loader] ||= proc do |eo|
|
1943
|
+
h = eo[:id_map]
|
1944
|
+
reciprocal = opts.reciprocal
|
1945
|
+
assign_singular = opts.assign_singular?
|
1946
|
+
delete_rn = opts.delete_row_number_column
|
1947
|
+
|
1948
|
+
eager_load_results(opts, eo) do |assoc_record|
|
1949
|
+
assoc_record.values.delete(delete_rn) if delete_rn
|
1950
|
+
hash_key = uses_cks ? km.map{|k| assoc_record.send(k)} : assoc_record.send(km)
|
1951
|
+
next unless objects = h[hash_key]
|
1952
|
+
if assign_singular
|
1953
|
+
objects.each do |object|
|
1954
|
+
unless object.associations[name]
|
1955
|
+
object.associations[name] = assoc_record
|
1956
|
+
assoc_record.associations[reciprocal] = object if reciprocal
|
1957
|
+
end
|
1958
|
+
end
|
1959
|
+
else
|
1960
|
+
objects.each do |object|
|
1961
|
+
object.associations[name].push(assoc_record)
|
1962
|
+
assoc_record.associations[reciprocal] = object if reciprocal
|
1963
|
+
end
|
1964
|
+
end
|
1965
|
+
end
|
1966
|
+
end
|
1967
|
+
|
1968
|
+
join_type = opts[:graph_join_type]
|
1969
|
+
select = opts[:graph_select]
|
1970
|
+
use_only_conditions = opts.include?(:graph_only_conditions)
|
1971
|
+
only_conditions = opts[:graph_only_conditions]
|
1972
|
+
conditions = opts[:graph_conditions]
|
1973
|
+
opts[:cartesian_product_number] ||= one_to_one ? 0 : 1
|
1974
|
+
graph_block = opts[:graph_block]
|
1975
|
+
opts[:eager_grapher] ||= proc do |eo|
|
1976
|
+
ds = eo[:self]
|
1977
|
+
ds = ds.graph(opts.apply_eager_graph_limit_strategy(eo[:limit_strategy], eager_graph_dataset(opts, eo)), use_only_conditions ? only_conditions : cks.zip(pkcs) + conditions, eo.merge(:select=>select, :join_type=>eo[:join_type]||join_type, :qualify=>:deep, :from_self_alias=>eo[:from_self_alias]), &graph_block)
|
1978
|
+
# We only load reciprocals for one_to_many associations, as other reciprocals don't make sense
|
1979
|
+
ds.opts[:eager_graph][:reciprocals][eo[:table_alias]] = opts.reciprocal
|
1980
|
+
ds
|
1981
|
+
end
|
1982
|
+
|
1983
|
+
return if opts[:read_only]
|
1984
|
+
|
1985
|
+
save_opts = {:validate=>opts[:validate]}
|
1986
|
+
ck_nil_hash ={}
|
1987
|
+
cks.each{|k| ck_nil_hash[k] = nil}
|
1988
|
+
|
1989
|
+
if one_to_one
|
1990
|
+
opts[:setter] ||= proc do |o|
|
1991
|
+
up_ds = _apply_association_options(opts, opts.associated_dataset.where(cks.zip(cpks.map{|k| send(k)})))
|
1992
|
+
if o
|
1993
|
+
up_ds = up_ds.exclude(o.pk_hash) unless o.new?
|
1994
|
+
cks.zip(cpks).each{|k, pk| o.send(:"#{k}=", send(pk))}
|
1995
|
+
end
|
1996
|
+
checked_transaction do
|
1997
|
+
up_ds.update(ck_nil_hash)
|
1998
|
+
o.save(save_opts) || raise(Sequel::Error, "invalid associated object, cannot save") if o
|
1999
|
+
end
|
2000
|
+
end
|
2001
|
+
opts[:_setter] = proc{|o| set_one_to_one_associated_object(opts, o)}
|
2002
|
+
else
|
2003
|
+
save_opts[:raise_on_failure] = opts[:raise_on_save_failure] != false
|
2004
|
+
|
2005
|
+
opts[:adder] ||= proc do |o|
|
2006
|
+
cks.zip(cpks).each{|k, pk| o.send(:"#{k}=", send(pk))}
|
2007
|
+
o.save(save_opts)
|
2008
|
+
end
|
2009
|
+
|
2010
|
+
opts[:remover] ||= proc do |o|
|
2011
|
+
cks.each{|k| o.send(:"#{k}=", nil)}
|
2012
|
+
o.save(save_opts)
|
2013
|
+
end
|
2014
|
+
|
2015
|
+
opts[:clearer] ||= proc do
|
2016
|
+
_apply_association_options(opts, opts.associated_dataset.where(cks.zip(cpks.map{|k| send(k)}))).update(ck_nil_hash)
|
2017
|
+
end
|
2018
|
+
end
|
2019
|
+
end
|
2020
|
+
|
2021
|
+
# Alias of def_many_to_many, since they share pretty much the same code.
|
2022
|
+
def def_one_through_one(opts)
|
2023
|
+
def_many_to_many(opts)
|
2024
|
+
end
|
2025
|
+
|
2026
|
+
# Alias of def_one_to_many, since they share pretty much the same code.
|
2027
|
+
def def_one_to_one(opts)
|
2028
|
+
def_one_to_many(opts)
|
2029
|
+
end
|
2030
|
+
|
2031
|
+
# Return dataset to graph into given the association reflection, applying the :callback option if set.
|
2032
|
+
def eager_graph_dataset(opts, eager_options)
|
2033
|
+
ds = opts.associated_class.dataset
|
2034
|
+
if cb = eager_options[:callback]
|
2035
|
+
ds = cb.call(ds)
|
2036
|
+
end
|
2037
|
+
ds
|
2038
|
+
end
|
2039
|
+
end
|
2040
|
+
|
2041
|
+
# Instance methods used to implement the associations support.
|
2042
|
+
module InstanceMethods
|
2043
|
+
# The currently cached associations. A hash with the keys being the
|
2044
|
+
# association name symbols and the values being the associated object
|
2045
|
+
# or nil (many_to_one), or the array of associated objects (*_to_many).
|
2046
|
+
def associations
|
2047
|
+
@associations ||= {}
|
2048
|
+
end
|
2049
|
+
|
2050
|
+
# Freeze the associations cache when freezing the object. Note that
|
2051
|
+
# retrieving associations after freezing will still work in most cases,
|
2052
|
+
# but the associations will not be cached in the association cache.
|
2053
|
+
def freeze
|
2054
|
+
associations.freeze
|
2055
|
+
super
|
2056
|
+
end
|
2057
|
+
|
2058
|
+
private
|
2059
|
+
|
2060
|
+
# Apply the association options such as :order and :limit to the given dataset, returning a modified dataset.
|
2061
|
+
def _apply_association_options(opts, ds)
|
2062
|
+
unless ds.kind_of?(AssociationDatasetMethods)
|
2063
|
+
ds = opts.apply_dataset_changes(ds)
|
2064
|
+
end
|
2065
|
+
ds.model_object = self
|
2066
|
+
ds = ds.eager_graph(opts[:eager_graph]) if opts[:eager_graph] && opts.eager_graph_lazy_dataset?
|
2067
|
+
ds = instance_exec(ds, &opts[:block]) if opts[:block]
|
2068
|
+
ds
|
2069
|
+
end
|
2070
|
+
|
2071
|
+
# Return a dataset for the association after applying any dynamic callback.
|
2072
|
+
def _associated_dataset(opts, dynamic_opts)
|
2073
|
+
ds = send(opts.dataset_method)
|
2074
|
+
if callback = dynamic_opts[:callback]
|
2075
|
+
ds = callback.call(ds)
|
2076
|
+
end
|
2077
|
+
ds
|
2078
|
+
end
|
2079
|
+
|
2080
|
+
# A placeholder literalizer that can be used to load the association, or nil to not use one.
|
2081
|
+
def _associated_object_loader(opts, dynamic_opts)
|
2082
|
+
if !dynamic_opts[:callback] && (loader = opts.placeholder_loader)
|
2083
|
+
loader
|
2084
|
+
end
|
2085
|
+
end
|
2086
|
+
|
2087
|
+
# Return an association dataset for the given association reflection
|
2088
|
+
def _dataset(opts)
|
2089
|
+
raise(Sequel::Error, "model object #{inspect} does not have a primary key") if opts.dataset_need_primary_key? && !pk
|
2090
|
+
ds = if opts[:dataset].arity == 1
|
2091
|
+
instance_exec(opts, &opts[:dataset])
|
2092
|
+
else
|
2093
|
+
instance_exec(&opts[:dataset])
|
2094
|
+
end
|
2095
|
+
_apply_association_options(opts, ds)
|
2096
|
+
end
|
2097
|
+
|
2098
|
+
# Dataset for the join table of the given many to many association reflection
|
2099
|
+
def _join_table_dataset(opts)
|
2100
|
+
ds = model.db.from(opts.join_table_source)
|
2101
|
+
opts[:join_table_block] ? opts[:join_table_block].call(ds) : ds
|
2102
|
+
end
|
2103
|
+
|
2104
|
+
# Return the associated single object for the given association reflection and dynamic options
|
2105
|
+
# (or nil if no associated object).
|
2106
|
+
def _load_associated_object(opts, dynamic_opts)
|
2107
|
+
_load_associated_object_array(opts, dynamic_opts).first
|
2108
|
+
end
|
2109
|
+
|
2110
|
+
# Return the associated single object using a primary key lookup on the associated class.
|
2111
|
+
def _load_associated_object_via_primary_key(opts)
|
2112
|
+
opts.associated_class.send(:primary_key_lookup, ((fk = opts[:key]).is_a?(Array) ? fk.map{|c| send(c)} : send(fk)))
|
2113
|
+
end
|
2114
|
+
|
2115
|
+
# Load the associated objects for the given association reflection and dynamic options
|
2116
|
+
# as an array.
|
2117
|
+
def _load_associated_object_array(opts, dynamic_opts)
|
2118
|
+
if loader = _associated_object_loader(opts, dynamic_opts)
|
2119
|
+
loader.all(*opts.predicate_key_values(self))
|
2120
|
+
else
|
2121
|
+
_associated_dataset(opts, dynamic_opts).all
|
2122
|
+
end
|
2123
|
+
end
|
2124
|
+
|
2125
|
+
# Return the associated objects from the dataset, without association callbacks, reciprocals, and caching.
|
2126
|
+
# Still apply the dynamic callback if present.
|
2127
|
+
def _load_associated_objects(opts, dynamic_opts=OPTS)
|
2128
|
+
if opts.can_have_associated_objects?(self)
|
2129
|
+
if opts.returns_array?
|
2130
|
+
_load_associated_object_array(opts, dynamic_opts)
|
2131
|
+
elsif load_with_primary_key_lookup?(opts, dynamic_opts)
|
2132
|
+
_load_associated_object_via_primary_key(opts)
|
2133
|
+
else
|
2134
|
+
_load_associated_object(opts, dynamic_opts)
|
2135
|
+
end
|
2136
|
+
elsif opts.returns_array?
|
2137
|
+
[]
|
2138
|
+
end
|
2139
|
+
end
|
2140
|
+
|
2141
|
+
# Clear the associations cache when refreshing
|
2142
|
+
def _refresh_set_values(hash)
|
2143
|
+
@associations.clear if @associations
|
2144
|
+
super
|
2145
|
+
end
|
2146
|
+
|
2147
|
+
# Add the given associated object to the given association
|
2148
|
+
def add_associated_object(opts, o, *args)
|
2149
|
+
klass = opts.associated_class
|
2150
|
+
if o.is_a?(Hash)
|
2151
|
+
o = klass.new(o)
|
2152
|
+
elsif o.is_a?(Integer) || o.is_a?(String) || o.is_a?(Array)
|
2153
|
+
o = klass.with_pk!(o)
|
2154
|
+
elsif !o.is_a?(klass)
|
2155
|
+
raise(Sequel::Error, "associated object #{o.inspect} not of correct type #{klass}")
|
2156
|
+
end
|
2157
|
+
raise(Sequel::Error, "model object #{inspect} does not have a primary key") if opts.dataset_need_primary_key? && !pk
|
2158
|
+
ensure_associated_primary_key(opts, o, *args)
|
2159
|
+
return if run_association_callbacks(opts, :before_add, o) == false
|
2160
|
+
return if !send(opts._add_method, o, *args) && opts.handle_silent_modification_failure?
|
2161
|
+
if array = associations[opts[:name]] and !array.include?(o)
|
2162
|
+
array.push(o)
|
2163
|
+
end
|
2164
|
+
add_reciprocal_object(opts, o)
|
2165
|
+
run_association_callbacks(opts, :after_add, o)
|
2166
|
+
o
|
2167
|
+
end
|
2168
|
+
|
2169
|
+
# Add/Set the current object to/as the given object's reciprocal association.
|
2170
|
+
def add_reciprocal_object(opts, o)
|
2171
|
+
return if o.frozen?
|
2172
|
+
return unless reciprocal = opts.reciprocal
|
2173
|
+
if opts.reciprocal_array?
|
2174
|
+
if array = o.associations[reciprocal] and !array.include?(self)
|
2175
|
+
array.push(self)
|
2176
|
+
end
|
2177
|
+
else
|
2178
|
+
o.associations[reciprocal] = self
|
2179
|
+
end
|
2180
|
+
end
|
2181
|
+
|
2182
|
+
# Call uniq! on the given array. This is used by the :uniq option,
|
2183
|
+
# and is an actual method for memory reasons.
|
2184
|
+
def array_uniq!(a)
|
2185
|
+
a.uniq!
|
2186
|
+
end
|
2187
|
+
|
2188
|
+
# If a foreign key column value changes, clear the related
|
2189
|
+
# cached associations.
|
2190
|
+
def change_column_value(column, value)
|
2191
|
+
if assocs = model.autoreloading_associations[column]
|
2192
|
+
assocs.each{|a| associations.delete(a)}
|
2193
|
+
end
|
2194
|
+
super
|
2195
|
+
end
|
2196
|
+
|
2197
|
+
# Save the associated object if the associated object needs a primary key
|
2198
|
+
# and the associated object is new and does not have one. Raise an error if
|
2199
|
+
# the object still does not have a primary key
|
2200
|
+
def ensure_associated_primary_key(opts, o, *args)
|
2201
|
+
if opts.need_associated_primary_key?
|
2202
|
+
o.save(:validate=>opts[:validate]) if o.new?
|
2203
|
+
raise(Sequel::Error, "associated object #{o.inspect} does not have a primary key") unless o.pk
|
2204
|
+
end
|
2205
|
+
end
|
2206
|
+
|
2207
|
+
# Load the associated objects using the dataset, handling callbacks, reciprocals, and caching.
|
2208
|
+
def load_associated_objects(opts, dynamic_opts=nil)
|
2209
|
+
if dynamic_opts == true or dynamic_opts == false or dynamic_opts == nil
|
2210
|
+
dynamic_opts = {:reload=>dynamic_opts}
|
2211
|
+
elsif dynamic_opts.respond_to?(:call)
|
2212
|
+
dynamic_opts = {:callback=>dynamic_opts}
|
2213
|
+
end
|
2214
|
+
if block_given?
|
2215
|
+
dynamic_opts = dynamic_opts.merge(:callback=>Proc.new)
|
2216
|
+
end
|
2217
|
+
name = opts[:name]
|
2218
|
+
if associations.include?(name) and !dynamic_opts[:callback] and !dynamic_opts[:reload]
|
2219
|
+
associations[name]
|
2220
|
+
else
|
2221
|
+
objs = _load_associated_objects(opts, dynamic_opts)
|
2222
|
+
if opts.set_reciprocal_to_self?
|
2223
|
+
if opts.returns_array?
|
2224
|
+
objs.each{|o| add_reciprocal_object(opts, o)}
|
2225
|
+
elsif objs
|
2226
|
+
add_reciprocal_object(opts, objs)
|
2227
|
+
end
|
2228
|
+
end
|
2229
|
+
|
2230
|
+
# If the current object is frozen, you can't update the associations
|
2231
|
+
# cache. This can cause issues for after_load procs that expect
|
2232
|
+
# the objects to be already cached in the associations, but
|
2233
|
+
# unfortunately that case cannot be handled.
|
2234
|
+
associations[name] = objs unless frozen?
|
2235
|
+
run_association_callbacks(opts, :after_load, objs)
|
2236
|
+
frozen? ? objs : associations[name]
|
2237
|
+
end
|
2238
|
+
end
|
2239
|
+
|
2240
|
+
# Whether to use a simple primary key lookup on the associated class when loading.
|
2241
|
+
def load_with_primary_key_lookup?(opts, dynamic_opts)
|
2242
|
+
opts[:type] == :many_to_one &&
|
2243
|
+
!dynamic_opts[:callback] &&
|
2244
|
+
opts.send(:cached_fetch, :many_to_one_pk_lookup){opts.primary_key == opts.associated_class.primary_key}
|
2245
|
+
end
|
2246
|
+
|
2247
|
+
# Remove all associated objects from the given association
|
2248
|
+
def remove_all_associated_objects(opts, *args)
|
2249
|
+
raise(Sequel::Error, "model object #{inspect} does not have a primary key") if opts.dataset_need_primary_key? && !pk
|
2250
|
+
send(opts._remove_all_method, *args)
|
2251
|
+
ret = associations[opts[:name]].each{|o| remove_reciprocal_object(opts, o)} if associations.include?(opts[:name])
|
2252
|
+
associations[opts[:name]] = []
|
2253
|
+
ret
|
2254
|
+
end
|
2255
|
+
|
2256
|
+
# Remove the given associated object from the given association
|
2257
|
+
def remove_associated_object(opts, o, *args)
|
2258
|
+
klass = opts.associated_class
|
2259
|
+
if o.is_a?(Integer) || o.is_a?(String) || o.is_a?(Array)
|
2260
|
+
o = remove_check_existing_object_from_pk(opts, o, *args)
|
2261
|
+
elsif !o.is_a?(klass)
|
2262
|
+
raise(Sequel::Error, "associated object #{o.inspect} not of correct type #{klass}")
|
2263
|
+
elsif opts.remove_should_check_existing? && send(opts.dataset_method).where(o.pk_hash).empty?
|
2264
|
+
raise(Sequel::Error, "associated object #{o.inspect} is not currently associated to #{inspect}")
|
2265
|
+
end
|
2266
|
+
raise(Sequel::Error, "model object #{inspect} does not have a primary key") if opts.dataset_need_primary_key? && !pk
|
2267
|
+
raise(Sequel::Error, "associated object #{o.inspect} does not have a primary key") if opts.need_associated_primary_key? && !o.pk
|
2268
|
+
return if run_association_callbacks(opts, :before_remove, o) == false
|
2269
|
+
return if !send(opts._remove_method, o, *args) && opts.handle_silent_modification_failure?
|
2270
|
+
associations[opts[:name]].delete_if{|x| o === x} if associations.include?(opts[:name])
|
2271
|
+
remove_reciprocal_object(opts, o)
|
2272
|
+
run_association_callbacks(opts, :after_remove, o)
|
2273
|
+
o
|
2274
|
+
end
|
2275
|
+
|
2276
|
+
# Check that the object from the associated table specified by the primary key
|
2277
|
+
# is currently associated to the receiver. If it is associated, return the object, otherwise
|
2278
|
+
# raise an error.
|
2279
|
+
def remove_check_existing_object_from_pk(opts, o, *args)
|
2280
|
+
key = o
|
2281
|
+
pkh = opts.associated_class.qualified_primary_key_hash(key)
|
2282
|
+
raise(Sequel::Error, "no object with key(s) #{key.inspect} is currently associated to #{inspect}") unless o = send(opts.dataset_method).first(pkh)
|
2283
|
+
o
|
2284
|
+
end
|
2285
|
+
|
2286
|
+
# Remove/unset the current object from/as the given object's reciprocal association.
|
2287
|
+
def remove_reciprocal_object(opts, o)
|
2288
|
+
return unless reciprocal = opts.reciprocal
|
2289
|
+
if opts.reciprocal_array?
|
2290
|
+
if array = o.associations[reciprocal]
|
2291
|
+
array.delete_if{|x| self === x}
|
2292
|
+
end
|
2293
|
+
else
|
2294
|
+
o.associations[reciprocal] = nil
|
2295
|
+
end
|
2296
|
+
end
|
2297
|
+
|
2298
|
+
# Run the callback for the association with the object.
|
2299
|
+
def run_association_callbacks(reflection, callback_type, object)
|
2300
|
+
raise_error = raise_on_save_failure || !reflection.returns_array?
|
2301
|
+
stop_on_false = [:before_add, :before_remove, :before_set].include?(callback_type)
|
2302
|
+
reflection[callback_type].each do |cb|
|
2303
|
+
res = case cb
|
2304
|
+
when Symbol
|
2305
|
+
send(cb, object)
|
2306
|
+
when Proc
|
2307
|
+
cb.call(self, object)
|
2308
|
+
else
|
2309
|
+
raise Error, "callbacks should either be Procs or Symbols"
|
2310
|
+
end
|
2311
|
+
if res == false and stop_on_false
|
2312
|
+
raise(BeforeHookFailed, "Unable to modify association for #{inspect}: one of the #{callback_type} hooks returned false") if raise_error
|
2313
|
+
return false
|
2314
|
+
end
|
2315
|
+
end
|
2316
|
+
end
|
2317
|
+
|
2318
|
+
# Set the given object as the associated object for the given *_to_one association reflection
|
2319
|
+
def _set_associated_object(opts, o)
|
2320
|
+
a = associations[opts[:name]]
|
2321
|
+
return if a && a == o && !set_associated_object_if_same?
|
2322
|
+
run_association_callbacks(opts, :before_set, o)
|
2323
|
+
remove_reciprocal_object(opts, a) if a
|
2324
|
+
send(opts._setter_method, o)
|
2325
|
+
associations[opts[:name]] = o
|
2326
|
+
add_reciprocal_object(opts, o) if o
|
2327
|
+
run_association_callbacks(opts, :after_set, o)
|
2328
|
+
o
|
2329
|
+
end
|
2330
|
+
|
2331
|
+
# Whether run the associated object setter code if passed the same object as the one already
|
2332
|
+
# cached in the association. Usually not set (so nil), can be set on a per-object basis
|
2333
|
+
# if necessary.
|
2334
|
+
def set_associated_object_if_same?
|
2335
|
+
@set_associated_object_if_same
|
2336
|
+
end
|
2337
|
+
|
2338
|
+
# Set the given object as the associated object for the given many_to_one association reflection
|
2339
|
+
def set_associated_object(opts, o)
|
2340
|
+
raise(Error, "associated object #{o.inspect} does not have a primary key") if o && !o.pk
|
2341
|
+
_set_associated_object(opts, o)
|
2342
|
+
end
|
2343
|
+
|
2344
|
+
# Set the given object as the associated object for the given one_to_one association reflection
|
2345
|
+
def set_one_to_one_associated_object(opts, o)
|
2346
|
+
raise(Error, "object #{inspect} does not have a primary key") unless pk
|
2347
|
+
_set_associated_object(opts, o)
|
2348
|
+
end
|
2349
|
+
end
|
2350
|
+
|
2351
|
+
# Eager loading makes it so that you can load all associated records for a
|
2352
|
+
# set of objects in a single query, instead of a separate query for each object.
|
2353
|
+
#
|
2354
|
+
# Two separate implementations are provided. +eager+ should be used most of the
|
2355
|
+
# time, as it loads associated records using one query per association. However,
|
2356
|
+
# it does not allow you the ability to filter or order based on columns in associated tables. +eager_graph+ loads
|
2357
|
+
# all records in a single query using JOINs, allowing you to filter or order based on columns in associated
|
2358
|
+
# tables. However, +eager_graph+ is usually slower than +eager+, especially if multiple
|
2359
|
+
# one_to_many or many_to_many associations are joined.
|
2360
|
+
#
|
2361
|
+
# You can cascade the eager loading (loading associations on associated objects)
|
2362
|
+
# with no limit to the depth of the cascades. You do this by passing a hash to +eager+ or +eager_graph+
|
2363
|
+
# with the keys being associations of the current model and values being
|
2364
|
+
# associations of the model associated with the current model via the key.
|
2365
|
+
#
|
2366
|
+
# The arguments can be symbols or hashes with symbol keys (for cascaded
|
2367
|
+
# eager loading). Examples:
|
2368
|
+
#
|
2369
|
+
# Album.eager(:artist).all
|
2370
|
+
# Album.eager_graph(:artist).all
|
2371
|
+
# Album.eager(:artist, :genre).all
|
2372
|
+
# Album.eager_graph(:artist, :genre).all
|
2373
|
+
# Album.eager(:artist).eager(:genre).all
|
2374
|
+
# Album.eager_graph(:artist).eager(:genre).all
|
2375
|
+
# Artist.eager(:albums=>:tracks).all
|
2376
|
+
# Artist.eager_graph(:albums=>:tracks).all
|
2377
|
+
# Artist.eager(:albums=>{:tracks=>:genre}).all
|
2378
|
+
# Artist.eager_graph(:albums=>{:tracks=>:genre}).all
|
2379
|
+
#
|
2380
|
+
# You can also pass a callback as a hash value in order to customize the dataset being
|
2381
|
+
# eager loaded at query time, analogous to the way the :eager_block association option
|
2382
|
+
# allows you to customize it at association definition time. For example,
|
2383
|
+
# if you wanted artists with their albums since 1990:
|
2384
|
+
#
|
2385
|
+
# Artist.eager(:albums => proc{|ds| ds.where{year > 1990}})
|
2386
|
+
#
|
2387
|
+
# Or if you needed albums and their artist's name only, using a single query:
|
2388
|
+
#
|
2389
|
+
# Albums.eager_graph(:artist => proc{|ds| ds.select(:name)})
|
2390
|
+
#
|
2391
|
+
# To cascade eager loading while using a callback, you substitute the cascaded
|
2392
|
+
# associations with a single entry hash that has the proc callback as the key and
|
2393
|
+
# the cascaded associations as the value. This will load artists with their albums
|
2394
|
+
# since 1990, and also the tracks on those albums and the genre for those tracks:
|
2395
|
+
#
|
2396
|
+
# Artist.eager(:albums => {proc{|ds| ds.where{year > 1990}}=>{:tracks => :genre}})
|
2397
|
+
module DatasetMethods
|
2398
|
+
Sequel::Dataset.def_mutation_method(:eager, :eager_graph, :module=>self)
|
2399
|
+
|
2400
|
+
%w'inner left right full'.each do |type|
|
2401
|
+
class_eval <<END, __FILE__, __LINE__+1
|
2402
|
+
def association_#{type}_join(*associations)
|
2403
|
+
_association_join(:#{type}, associations)
|
2404
|
+
end
|
2405
|
+
END
|
2406
|
+
end
|
2407
|
+
|
2408
|
+
# Adds one or more INNER JOINs to the existing dataset using the keys and conditions
|
2409
|
+
# specified by the given association. The following methods also exist for specifying
|
2410
|
+
# a different type of JOIN:
|
2411
|
+
#
|
2412
|
+
# association_full_join :: FULL JOIN
|
2413
|
+
# association_inner_join :: INNER JOIN
|
2414
|
+
# association_left_join :: LEFT JOIN
|
2415
|
+
# association_right_join :: RIGHT JOIN
|
2416
|
+
def association_join(*associations)
|
2417
|
+
association_inner_join(*associations)
|
2418
|
+
end
|
2419
|
+
|
2420
|
+
# If the expression is in the form <tt>x = y</tt> where +y+ is a <tt>Sequel::Model</tt>
|
2421
|
+
# instance, array of <tt>Sequel::Model</tt> instances, or a <tt>Sequel::Model</tt> dataset,
|
2422
|
+
# assume +x+ is an association symbol and look up the association reflection
|
2423
|
+
# via the dataset's model. From there, return the appropriate SQL based on the type of
|
2424
|
+
# association and the values of the foreign/primary keys of +y+. For most association
|
2425
|
+
# types, this is a simple transformation, but for +many_to_many+ associations this
|
2426
|
+
# creates a subquery to the join table.
|
2427
|
+
def complex_expression_sql_append(sql, op, args)
|
2428
|
+
r = args.at(1)
|
2429
|
+
if (((op == :'=' || op == :'!=') and r.is_a?(Sequel::Model)) ||
|
2430
|
+
(multiple = ((op == :IN || op == :'NOT IN') and ((is_ds = r.is_a?(Sequel::Dataset)) or r.all?{|x| x.is_a?(Sequel::Model)}))))
|
2431
|
+
l = args.at(0)
|
2432
|
+
if ar = model.association_reflections[l]
|
2433
|
+
if multiple
|
2434
|
+
klass = ar.associated_class
|
2435
|
+
if is_ds
|
2436
|
+
if r.respond_to?(:model)
|
2437
|
+
unless r.model <= klass
|
2438
|
+
# A dataset for a different model class, could be a valid regular query
|
2439
|
+
return super
|
2440
|
+
end
|
2441
|
+
else
|
2442
|
+
# Not a model dataset, could be a valid regular query
|
2443
|
+
return super
|
2444
|
+
end
|
2445
|
+
else
|
2446
|
+
unless r.all?{|x| x.is_a?(klass)}
|
2447
|
+
raise Sequel::Error, "invalid association class for one object for association #{l.inspect} used in dataset filter for model #{model.inspect}, expected class #{klass.inspect}"
|
2448
|
+
end
|
2449
|
+
end
|
2450
|
+
elsif !r.is_a?(ar.associated_class)
|
2451
|
+
raise Sequel::Error, "invalid association class #{r.class.inspect} for association #{l.inspect} used in dataset filter for model #{model.inspect}, expected class #{ar.associated_class.inspect}"
|
2452
|
+
end
|
2453
|
+
|
2454
|
+
if exp = association_filter_expression(op, ar, r)
|
2455
|
+
literal_append(sql, exp)
|
2456
|
+
else
|
2457
|
+
raise Sequel::Error, "invalid association type #{ar[:type].inspect} for association #{l.inspect} used in dataset filter for model #{model.inspect}"
|
2458
|
+
end
|
2459
|
+
elsif multiple && (is_ds || r.empty?)
|
2460
|
+
# Not a query designed for this support, could be a valid regular query
|
2461
|
+
super
|
2462
|
+
else
|
2463
|
+
raise Sequel::Error, "invalid association #{l.inspect} used in dataset filter for model #{model.inspect}"
|
2464
|
+
end
|
2465
|
+
else
|
2466
|
+
super
|
2467
|
+
end
|
2468
|
+
end
|
2469
|
+
|
2470
|
+
# The preferred eager loading method. Loads all associated records using one
|
2471
|
+
# query for each association.
|
2472
|
+
#
|
2473
|
+
# The basic idea for how it works is that the dataset is first loaded normally.
|
2474
|
+
# Then it goes through all associations that have been specified via +eager+.
|
2475
|
+
# It loads each of those associations separately, then associates them back
|
2476
|
+
# to the original dataset via primary/foreign keys. Due to the necessity of
|
2477
|
+
# all objects being present, you need to use +all+ to use eager loading, as it
|
2478
|
+
# can't work with +each+.
|
2479
|
+
#
|
2480
|
+
# This implementation avoids the complexity of extracting an object graph out
|
2481
|
+
# of a single dataset, by building the object graph out of multiple datasets,
|
2482
|
+
# one for each association. By using a separate dataset for each association,
|
2483
|
+
# it avoids problems such as aliasing conflicts and creating cartesian product
|
2484
|
+
# result sets if multiple one_to_many or many_to_many eager associations are requested.
|
2485
|
+
#
|
2486
|
+
# One limitation of using this method is that you cannot filter the dataset
|
2487
|
+
# based on values of columns in an associated table, since the associations are loaded
|
2488
|
+
# in separate queries. To do that you need to load all associations in the
|
2489
|
+
# same query, and extract an object graph from the results of that query. If you
|
2490
|
+
# need to filter based on columns in associated tables, look at +eager_graph+
|
2491
|
+
# or join the tables you need to filter on manually.
|
2492
|
+
#
|
2493
|
+
# Each association's order, if defined, is respected.
|
2494
|
+
# If the association uses a block or has an :eager_block argument, it is used.
|
2495
|
+
def eager(*associations)
|
2496
|
+
opts = @opts[:eager]
|
2497
|
+
association_opts = eager_options_for_associations(associations)
|
2498
|
+
opts = opts ? opts.merge(association_opts) : association_opts
|
2499
|
+
clone(:eager=>opts)
|
2500
|
+
end
|
2501
|
+
|
2502
|
+
# The secondary eager loading method. Loads all associations in a single query. This
|
2503
|
+
# method should only be used if you need to filter or order based on columns in associated tables.
|
2504
|
+
#
|
2505
|
+
# This method uses <tt>Dataset#graph</tt> to create appropriate aliases for columns in all the
|
2506
|
+
# tables. Then it uses the graph's metadata to build the associations from the single hash, and
|
2507
|
+
# finally replaces the array of hashes with an array model objects inside all.
|
2508
|
+
#
|
2509
|
+
# Be very careful when using this with multiple one_to_many or many_to_many associations, as you can
|
2510
|
+
# create large cartesian products. If you must graph multiple one_to_many and many_to_many associations,
|
2511
|
+
# make sure your filters are narrow if you have a large database.
|
2512
|
+
#
|
2513
|
+
# Each association's order, if definied, is respected. +eager_graph+ probably
|
2514
|
+
# won't work correctly on a limited dataset, unless you are
|
2515
|
+
# only graphing many_to_one, one_to_one, and one_through_one associations.
|
2516
|
+
#
|
2517
|
+
# Does not use the block defined for the association, since it does a single query for
|
2518
|
+
# all objects. You can use the :graph_* association options to modify the SQL query.
|
2519
|
+
#
|
2520
|
+
# Like +eager+, you need to call +all+ on the dataset for the eager loading to work. If you just
|
2521
|
+
# call +each+, it will yield plain hashes, each containing all columns from all the tables.
|
2522
|
+
def eager_graph(*associations)
|
2523
|
+
eager_graph_with_options(associations)
|
2524
|
+
end
|
2525
|
+
|
2526
|
+
# Run eager_graph with some options specific to just this call. Unlike eager_graph, this takes
|
2527
|
+
# the associations as a single argument instead of multiple arguments.
|
2528
|
+
#
|
2529
|
+
# Options:
|
2530
|
+
#
|
2531
|
+
# :join_type :: Override the join type specified in the association
|
2532
|
+
# :limit_strategy :: Use a strategy for handling limits on associations.
|
2533
|
+
# Appropriate :limit_strategy values are:
|
2534
|
+
# true :: Pick the most appropriate based on what the database supports
|
2535
|
+
# :distinct_on :: Force use of DISTINCT ON stategy (*_one associations only)
|
2536
|
+
# :correlated_subquery :: Force use of correlated subquery strategy (one_to_* associations only)
|
2537
|
+
# :window_function :: Force use of window function strategy
|
2538
|
+
# :ruby :: Don't modify the SQL, implement limits/offsets with array slicing
|
2539
|
+
#
|
2540
|
+
# This can also be a hash with association name symbol keys and one of the above values,
|
2541
|
+
# to use different strategies per association.
|
2542
|
+
#
|
2543
|
+
# The default is the :ruby strategy. Choosing a different strategy can make your code
|
2544
|
+
# significantly slower in some cases (perhaps even the majority of cases), so you should
|
2545
|
+
# only use this if you have benchmarked that it is faster for your use cases.
|
2546
|
+
def eager_graph_with_options(associations, opts=OPTS)
|
2547
|
+
associations = [associations] unless associations.is_a?(Array)
|
2548
|
+
if eg = @opts[:eager_graph]
|
2549
|
+
eg = eg.dup
|
2550
|
+
[:requirements, :reflections, :reciprocals, :limits].each{|k| eg[k] = eg[k].dup}
|
2551
|
+
eg[:local] = opts
|
2552
|
+
ds = clone(:eager_graph=>eg)
|
2553
|
+
ds.eager_graph_associations(ds, model, ds.opts[:eager_graph][:master], [], *associations)
|
2554
|
+
else
|
2555
|
+
# Each of the following have a symbol key for the table alias, with the following values:
|
2556
|
+
# :reciprocals :: the reciprocal value to use for this association
|
2557
|
+
# :reflections :: AssociationReflection instance related to this association
|
2558
|
+
# :requirements :: array of requirements for this association
|
2559
|
+
# :limits :: Any limit/offset array slicing that need to be handled in ruby land after loading
|
2560
|
+
opts = {:requirements=>{}, :master=>alias_symbol(first_source), :reflections=>{}, :reciprocals=>{}, :limits=>{}, :local=>opts, :cartesian_product_number=>0, :row_proc=>row_proc}
|
2561
|
+
ds = clone(:eager_graph=>opts)
|
2562
|
+
ds.eager_graph_associations(ds, model, ds.opts[:eager_graph][:master], [], *associations).naked
|
2563
|
+
end
|
2564
|
+
end
|
2565
|
+
|
2566
|
+
# Do not attempt to split the result set into associations,
|
2567
|
+
# just return results as simple objects. This is useful if you
|
2568
|
+
# want to use eager_graph as a shortcut to have all of the joins
|
2569
|
+
# and aliasing set up, but want to do something else with the dataset.
|
2570
|
+
def ungraphed
|
2571
|
+
ds = super.clone(:eager_graph=>nil)
|
2572
|
+
if (eg = @opts[:eager_graph]) && (rp = eg[:row_proc])
|
2573
|
+
ds.row_proc = rp
|
2574
|
+
end
|
2575
|
+
ds
|
2576
|
+
end
|
2577
|
+
|
2578
|
+
protected
|
2579
|
+
|
2580
|
+
# Call graph on the association with the correct arguments,
|
2581
|
+
# update the eager_graph data structure, and recurse into
|
2582
|
+
# eager_graph_associations if there are any passed in associations
|
2583
|
+
# (which would be dependencies of the current association)
|
2584
|
+
#
|
2585
|
+
# Arguments:
|
2586
|
+
# ds :: Current dataset
|
2587
|
+
# model :: Current Model
|
2588
|
+
# ta :: table_alias used for the parent association
|
2589
|
+
# requirements :: an array, used as a stack for requirements
|
2590
|
+
# r :: association reflection for the current association, or an SQL::AliasedExpression
|
2591
|
+
# with the reflection as the expression and the alias base as the aliaz.
|
2592
|
+
# *associations :: any associations dependent on this one
|
2593
|
+
def eager_graph_association(ds, model, ta, requirements, r, *associations)
|
2594
|
+
if r.is_a?(SQL::AliasedExpression)
|
2595
|
+
alias_base = r.alias
|
2596
|
+
r = r.expression
|
2597
|
+
else
|
2598
|
+
alias_base = r[:graph_alias_base]
|
2599
|
+
end
|
2600
|
+
assoc_table_alias = ds.unused_table_alias(alias_base)
|
2601
|
+
loader = r[:eager_grapher]
|
2602
|
+
if !associations.empty?
|
2603
|
+
if associations.first.respond_to?(:call)
|
2604
|
+
callback = associations.first
|
2605
|
+
associations = {}
|
2606
|
+
elsif associations.length == 1 && (assocs = associations.first).is_a?(Hash) && assocs.length == 1 && (pr_assoc = assocs.to_a.first) && pr_assoc.first.respond_to?(:call)
|
2607
|
+
callback, assoc = pr_assoc
|
2608
|
+
associations = assoc.is_a?(Array) ? assoc : [assoc]
|
2609
|
+
end
|
2610
|
+
end
|
2611
|
+
local_opts = ds.opts[:eager_graph][:local]
|
2612
|
+
limit_strategy = r.eager_graph_limit_strategy(local_opts[:limit_strategy])
|
2613
|
+
ds = loader.call(:self=>ds, :table_alias=>assoc_table_alias, :implicit_qualifier=>(ta == ds.opts[:eager_graph][:master]) ? first_source : qualifier_from_alias_symbol(ta, first_source), :callback=>callback, :join_type=>local_opts[:join_type], :join_only=>local_opts[:join_only], :limit_strategy=>limit_strategy, :from_self_alias=>ds.opts[:eager_graph][:master])
|
2614
|
+
if r[:order_eager_graph] && (order = r.fetch(:graph_order, r[:order]))
|
2615
|
+
ds = ds.order_more(*qualified_expression(order, assoc_table_alias))
|
2616
|
+
end
|
2617
|
+
eager_graph = ds.opts[:eager_graph]
|
2618
|
+
eager_graph[:requirements][assoc_table_alias] = requirements.dup
|
2619
|
+
eager_graph[:reflections][assoc_table_alias] = r
|
2620
|
+
if limit_strategy == :ruby
|
2621
|
+
eager_graph[:limits][assoc_table_alias] = r.limit_and_offset
|
2622
|
+
end
|
2623
|
+
eager_graph[:cartesian_product_number] += r[:cartesian_product_number] || 2
|
2624
|
+
ds = ds.eager_graph_associations(ds, r.associated_class, assoc_table_alias, requirements + [assoc_table_alias], *associations) unless associations.empty?
|
2625
|
+
ds
|
2626
|
+
end
|
2627
|
+
|
2628
|
+
# Check the associations are valid for the given model.
|
2629
|
+
# Call eager_graph_association on each association.
|
2630
|
+
#
|
2631
|
+
# Arguments:
|
2632
|
+
# ds :: Current dataset
|
2633
|
+
# model :: Current Model
|
2634
|
+
# ta :: table_alias used for the parent association
|
2635
|
+
# requirements :: an array, used as a stack for requirements
|
2636
|
+
# *associations :: the associations to add to the graph
|
2637
|
+
def eager_graph_associations(ds, model, ta, requirements, *associations)
|
2638
|
+
return ds if associations.empty?
|
2639
|
+
associations.flatten.each do |association|
|
2640
|
+
ds = case association
|
2641
|
+
when Symbol, SQL::AliasedExpression
|
2642
|
+
ds.eager_graph_association(ds, model, ta, requirements, eager_graph_check_association(model, association))
|
2643
|
+
when Hash
|
2644
|
+
association.each do |assoc, assoc_assocs|
|
2645
|
+
ds = ds.eager_graph_association(ds, model, ta, requirements, eager_graph_check_association(model, assoc), assoc_assocs)
|
2646
|
+
end
|
2647
|
+
ds
|
2648
|
+
else
|
2649
|
+
raise(Sequel::Error, 'Associations must be in the form of a symbol or hash')
|
2650
|
+
end
|
2651
|
+
end
|
2652
|
+
ds
|
2653
|
+
end
|
2654
|
+
|
2655
|
+
# Replace the array of plain hashes with an array of model objects will all eager_graphed
|
2656
|
+
# associations set in the associations cache for each object.
|
2657
|
+
def eager_graph_build_associations(hashes)
|
2658
|
+
hashes.replace(EagerGraphLoader.new(self).load(hashes))
|
2659
|
+
end
|
2660
|
+
|
2661
|
+
private
|
2662
|
+
|
2663
|
+
# Return a new dataset with JOINs of the given type added, using the tables and
|
2664
|
+
# conditions specified by the associations.
|
2665
|
+
def _association_join(type, associations)
|
2666
|
+
clone(:join=>clone(:graph_from_self=>false).eager_graph_with_options(associations, :join_type=>type, :join_only=>true).opts[:join])
|
2667
|
+
end
|
2668
|
+
|
2669
|
+
# If the association has conditions itself, then it requires additional filters be
|
2670
|
+
# added to the current dataset to ensure that the passed in object would also be
|
2671
|
+
# included by the association's conditions.
|
2672
|
+
def add_association_filter_conditions(ref, obj, expr)
|
2673
|
+
if expr != SQL::Constants::FALSE && ref.filter_by_associations_add_conditions?
|
2674
|
+
Sequel.expr(ref.filter_by_associations_conditions_expression(obj))
|
2675
|
+
else
|
2676
|
+
expr
|
2677
|
+
end
|
2678
|
+
end
|
2679
|
+
|
2680
|
+
# Process the array of associations arguments (Symbols, Arrays, and Hashes),
|
2681
|
+
# and return a hash of options suitable for cascading.
|
2682
|
+
def eager_options_for_associations(associations)
|
2683
|
+
opts = {}
|
2684
|
+
associations.flatten.each do |association|
|
2685
|
+
case association
|
2686
|
+
when Symbol
|
2687
|
+
check_association(model, association)
|
2688
|
+
opts[association] = nil
|
2689
|
+
when Hash
|
2690
|
+
association.keys.each{|assoc| check_association(model, assoc)}
|
2691
|
+
opts.merge!(association)
|
2692
|
+
else
|
2693
|
+
raise(Sequel::Error, 'Associations must be in the form of a symbol or hash')
|
2694
|
+
end
|
2695
|
+
end
|
2696
|
+
opts
|
2697
|
+
end
|
2698
|
+
|
2699
|
+
# Return an expression for filtering by the given association reflection and associated object.
|
2700
|
+
def association_filter_expression(op, ref, obj)
|
2701
|
+
meth = :"#{ref[:type]}_association_filter_expression"
|
2702
|
+
send(meth, op, ref, obj) if respond_to?(meth, true)
|
2703
|
+
end
|
2704
|
+
|
2705
|
+
# Handle inversion for association filters by returning an inverted expression,
|
2706
|
+
# plus also handling cases where the referenced columns are NULL.
|
2707
|
+
def association_filter_handle_inversion(op, exp, cols)
|
2708
|
+
if op == :'!=' || op == :'NOT IN'
|
2709
|
+
if exp == SQL::Constants::FALSE
|
2710
|
+
~exp
|
2711
|
+
else
|
2712
|
+
~exp | Sequel::SQL::BooleanExpression.from_value_pairs(cols.zip([]), :OR)
|
2713
|
+
end
|
2714
|
+
else
|
2715
|
+
exp
|
2716
|
+
end
|
2717
|
+
end
|
2718
|
+
|
2719
|
+
# Return an expression for making sure that the given keys match the value of
|
2720
|
+
# the given methods for either the single object given or for any of the objects
|
2721
|
+
# given if +obj+ is an array.
|
2722
|
+
def association_filter_key_expression(keys, meths, obj)
|
2723
|
+
vals = if obj.is_a?(Sequel::Dataset)
|
2724
|
+
{(keys.length == 1 ? keys.first : keys)=>obj.select(*meths).exclude(Sequel::SQL::BooleanExpression.from_value_pairs(meths.zip([]), :OR))}
|
2725
|
+
else
|
2726
|
+
vals = Array(obj).reject{|o| !meths.all?{|m| o.send(m)}}
|
2727
|
+
return SQL::Constants::FALSE if vals.empty?
|
2728
|
+
if obj.is_a?(Array)
|
2729
|
+
if keys.length == 1
|
2730
|
+
meth = meths.first
|
2731
|
+
{keys.first=>vals.map{|o| o.send(meth)}}
|
2732
|
+
else
|
2733
|
+
{keys=>vals.map{|o| meths.map{|m| o.send(m)}}}
|
2734
|
+
end
|
2735
|
+
else
|
2736
|
+
keys.zip(meths.map{|k| obj.send(k)})
|
2737
|
+
end
|
2738
|
+
end
|
2739
|
+
SQL::BooleanExpression.from_value_pairs(vals)
|
2740
|
+
end
|
2741
|
+
|
2742
|
+
# Make sure the association is valid for this model, and return the related AssociationReflection.
|
2743
|
+
def check_association(model, association)
|
2744
|
+
raise(Sequel::UndefinedAssociation, "Invalid association #{association} for #{model.name}") unless reflection = model.association_reflection(association)
|
2745
|
+
raise(Sequel::Error, "Eager loading is not allowed for #{model.name} association #{association}") if reflection[:allow_eager] == false
|
2746
|
+
reflection
|
2747
|
+
end
|
2748
|
+
|
2749
|
+
# Allow associations that are eagerly graphed to be specified as an SQL::AliasedExpression, for
|
2750
|
+
# per-call determining of the alias base.
|
2751
|
+
def eager_graph_check_association(model, association)
|
2752
|
+
if association.is_a?(SQL::AliasedExpression)
|
2753
|
+
SQL::AliasedExpression.new(check_association(model, association.expression), association.alias)
|
2754
|
+
else
|
2755
|
+
check_association(model, association)
|
2756
|
+
end
|
2757
|
+
end
|
2758
|
+
|
2759
|
+
# Eagerly load all specified associations
|
2760
|
+
def eager_load(a, eager_assoc=@opts[:eager])
|
2761
|
+
return if a.empty?
|
2762
|
+
# Key is foreign/primary key name symbol
|
2763
|
+
# Value is hash with keys being foreign/primary key values (generally integers)
|
2764
|
+
# and values being an array of current model objects with that
|
2765
|
+
# specific foreign/primary key
|
2766
|
+
key_hash = {}
|
2767
|
+
# Reflections for all associations to eager load
|
2768
|
+
reflections = eager_assoc.keys.collect{|assoc| model.association_reflection(assoc) || (raise Sequel::UndefinedAssociation, "Model: #{self}, Association: #{assoc}")}
|
2769
|
+
|
2770
|
+
# Populate the key_hash entry for each association being eagerly loaded
|
2771
|
+
reflections.each do |r|
|
2772
|
+
if key = r.eager_loader_key
|
2773
|
+
# key_hash for this key has already been populated,
|
2774
|
+
# skip populating again so that duplicate values
|
2775
|
+
# aren't added.
|
2776
|
+
unless id_map = key_hash[key]
|
2777
|
+
id_map = key_hash[key] = Hash.new{|h,k| h[k] = []}
|
2778
|
+
|
2779
|
+
# Supporting both single (Symbol) and composite (Array) keys.
|
2780
|
+
a.each do |rec|
|
2781
|
+
case key
|
2782
|
+
when Array
|
2783
|
+
if (k = key.map{|k2| rec.send(k2)}) && k.all?
|
2784
|
+
id_map[k] << rec
|
2785
|
+
end
|
2786
|
+
when Symbol
|
2787
|
+
if k = rec.send(key)
|
2788
|
+
id_map[k] << rec
|
2789
|
+
end
|
2790
|
+
else
|
2791
|
+
raise Error, "unhandled eager_loader_key #{key.inspect} for association #{r[:name]}"
|
2792
|
+
end
|
2793
|
+
end
|
2794
|
+
end
|
2795
|
+
else
|
2796
|
+
id_map = nil
|
2797
|
+
end
|
2798
|
+
|
2799
|
+
loader = r[:eager_loader]
|
2800
|
+
associations = eager_assoc[r[:name]]
|
2801
|
+
if associations.respond_to?(:call)
|
2802
|
+
eager_block = associations
|
2803
|
+
associations = {}
|
2804
|
+
elsif associations.is_a?(Hash) && associations.length == 1 && (pr_assoc = associations.to_a.first) && pr_assoc.first.respond_to?(:call)
|
2805
|
+
eager_block, associations = pr_assoc
|
2806
|
+
end
|
2807
|
+
loader.call(:key_hash=>key_hash, :rows=>a, :associations=>associations, :self=>self, :eager_block=>eager_block, :id_map=>id_map)
|
2808
|
+
a.each{|object| object.send(:run_association_callbacks, r, :after_load, object.associations[r[:name]])} unless r[:after_load].empty?
|
2809
|
+
end
|
2810
|
+
end
|
2811
|
+
|
2812
|
+
# Return a subquery expression for filering by a many_to_many association
|
2813
|
+
def many_to_many_association_filter_expression(op, ref, obj)
|
2814
|
+
lpks, lks, rks = ref.values_at(:left_primary_key_columns, :left_keys, :right_keys)
|
2815
|
+
jt = ref.join_table_alias
|
2816
|
+
lpks = lpks.first if lpks.length == 1
|
2817
|
+
lpks = ref.qualify(model.table_name, lpks)
|
2818
|
+
|
2819
|
+
meths = if obj.is_a?(Sequel::Dataset)
|
2820
|
+
ref.qualify(obj.model.table_name, ref.right_primary_keys)
|
2821
|
+
else
|
2822
|
+
ref.right_primary_key_methods
|
2823
|
+
end
|
2824
|
+
|
2825
|
+
expr = association_filter_key_expression(ref.qualify(jt, rks), meths, obj)
|
2826
|
+
unless expr == SQL::Constants::FALSE
|
2827
|
+
expr = SQL::BooleanExpression.from_value_pairs(lpks=>model.db.from(ref[:join_table]).select(*ref.qualify(jt, lks)).where(expr).exclude(SQL::BooleanExpression.from_value_pairs(ref.qualify(jt, lks).zip([]), :OR)))
|
2828
|
+
expr = add_association_filter_conditions(ref, obj, expr)
|
2829
|
+
end
|
2830
|
+
|
2831
|
+
association_filter_handle_inversion(op, expr, Array(lpks))
|
2832
|
+
end
|
2833
|
+
alias one_through_one_association_filter_expression many_to_many_association_filter_expression
|
2834
|
+
|
2835
|
+
# Return a simple equality expression for filering by a many_to_one association
|
2836
|
+
def many_to_one_association_filter_expression(op, ref, obj)
|
2837
|
+
keys = ref.qualify(model.table_name, ref[:key_columns])
|
2838
|
+
meths = if obj.is_a?(Sequel::Dataset)
|
2839
|
+
ref.qualify(obj.model.table_name, ref.primary_keys)
|
2840
|
+
else
|
2841
|
+
ref.primary_key_methods
|
2842
|
+
end
|
2843
|
+
|
2844
|
+
expr = association_filter_key_expression(keys, meths, obj)
|
2845
|
+
expr = add_association_filter_conditions(ref, obj, expr)
|
2846
|
+
association_filter_handle_inversion(op, expr, keys)
|
2847
|
+
end
|
2848
|
+
|
2849
|
+
# Return a simple equality expression for filering by a one_to_* association
|
2850
|
+
def one_to_many_association_filter_expression(op, ref, obj)
|
2851
|
+
keys = ref.qualify(model.table_name, ref[:primary_key_columns])
|
2852
|
+
meths = if obj.is_a?(Sequel::Dataset)
|
2853
|
+
ref.qualify(obj.model.table_name, ref[:keys])
|
2854
|
+
else
|
2855
|
+
ref[:key_methods]
|
2856
|
+
end
|
2857
|
+
|
2858
|
+
expr = association_filter_key_expression(keys, meths, obj)
|
2859
|
+
expr = add_association_filter_conditions(ref, obj, expr)
|
2860
|
+
association_filter_handle_inversion(op, expr, keys)
|
2861
|
+
end
|
2862
|
+
alias one_to_one_association_filter_expression one_to_many_association_filter_expression
|
2863
|
+
|
2864
|
+
# Build associations from the graph if #eager_graph was used,
|
2865
|
+
# and/or load other associations if #eager was used.
|
2866
|
+
def post_load(all_records)
|
2867
|
+
eager_graph_build_associations(all_records) if @opts[:eager_graph]
|
2868
|
+
eager_load(all_records) if @opts[:eager] && (row_proc || @opts[:eager_graph])
|
2869
|
+
super
|
2870
|
+
end
|
2871
|
+
end
|
2872
|
+
|
2873
|
+
# This class is the internal implementation of eager_graph. It is responsible for taking an array of plain
|
2874
|
+
# hashes and returning an array of model objects with all eager_graphed associations already set in the
|
2875
|
+
# association cache.
|
2876
|
+
class EagerGraphLoader
|
2877
|
+
# Hash with table alias symbol keys and after_load hook values
|
2878
|
+
attr_reader :after_load_map
|
2879
|
+
|
2880
|
+
# Hash with table alias symbol keys and association name values
|
2881
|
+
attr_reader :alias_map
|
2882
|
+
|
2883
|
+
# Hash with table alias symbol keys and subhash values mapping column_alias symbols to the
|
2884
|
+
# symbol of the real name of the column
|
2885
|
+
attr_reader :column_maps
|
2886
|
+
|
2887
|
+
# Recursive hash with table alias symbol keys mapping to hashes with dependent table alias symbol keys.
|
2888
|
+
attr_reader :dependency_map
|
2889
|
+
|
2890
|
+
# Hash with table alias symbol keys and [limit, offset] values
|
2891
|
+
attr_reader :limit_map
|
2892
|
+
|
2893
|
+
# Hash with table alias symbol keys and callable values used to create model instances
|
2894
|
+
# The table alias symbol for the primary model
|
2895
|
+
attr_reader :master
|
2896
|
+
|
2897
|
+
# Hash with table alias symbol keys and primary key symbol values (or arrays of primary key symbols for
|
2898
|
+
# composite key tables)
|
2899
|
+
attr_reader :primary_keys
|
2900
|
+
|
2901
|
+
# Hash with table alias symbol keys and reciprocal association symbol values,
|
2902
|
+
# used for setting reciprocals for one_to_many associations.
|
2903
|
+
attr_reader :reciprocal_map
|
2904
|
+
|
2905
|
+
# Hash with table alias symbol keys and subhash values mapping primary key symbols (or array of symbols)
|
2906
|
+
# to model instances. Used so that only a single model instance is created for each object.
|
2907
|
+
attr_reader :records_map
|
2908
|
+
|
2909
|
+
# Hash with table alias symbol keys and AssociationReflection values
|
2910
|
+
attr_reader :reflection_map
|
2911
|
+
|
2912
|
+
# Hash with table alias symbol keys and callable values used to create model instances
|
2913
|
+
attr_reader :row_procs
|
2914
|
+
|
2915
|
+
# Hash with table alias symbol keys and true/false values, where true means the
|
2916
|
+
# association represented by the table alias uses an array of values instead of
|
2917
|
+
# a single value (i.e. true => *_many, false => *_to_one).
|
2918
|
+
attr_reader :type_map
|
2919
|
+
|
2920
|
+
# Initialize all of the data structures used during loading.
|
2921
|
+
def initialize(dataset)
|
2922
|
+
opts = dataset.opts
|
2923
|
+
eager_graph = opts[:eager_graph]
|
2924
|
+
@master = eager_graph[:master]
|
2925
|
+
requirements = eager_graph[:requirements]
|
2926
|
+
reflection_map = @reflection_map = eager_graph[:reflections]
|
2927
|
+
reciprocal_map = @reciprocal_map = eager_graph[:reciprocals]
|
2928
|
+
limit_map = @limit_map = eager_graph[:limits]
|
2929
|
+
@unique = eager_graph[:cartesian_product_number] > 1
|
2930
|
+
|
2931
|
+
alias_map = @alias_map = {}
|
2932
|
+
type_map = @type_map = {}
|
2933
|
+
after_load_map = @after_load_map = {}
|
2934
|
+
reflection_map.each do |k, v|
|
2935
|
+
alias_map[k] = v[:name]
|
2936
|
+
after_load_map[k] = v[:after_load] unless v[:after_load].empty?
|
2937
|
+
type_map[k] = if v.returns_array?
|
2938
|
+
true
|
2939
|
+
elsif (limit_and_offset = limit_map[k]) && !limit_and_offset.last.nil?
|
2940
|
+
:offset
|
2941
|
+
end
|
2942
|
+
end
|
2943
|
+
|
2944
|
+
# Make dependency map hash out of requirements array for each association.
|
2945
|
+
# This builds a tree of dependencies that will be used for recursion
|
2946
|
+
# to ensure that all parts of the object graph are loaded into the
|
2947
|
+
# appropriate subordinate association.
|
2948
|
+
@dependency_map = {}
|
2949
|
+
# Sort the associations by requirements length, so that
|
2950
|
+
# requirements are added to the dependency hash before their
|
2951
|
+
# dependencies.
|
2952
|
+
requirements.sort_by{|a| a[1].length}.each do |ta, deps|
|
2953
|
+
if deps.empty?
|
2954
|
+
dependency_map[ta] = {}
|
2955
|
+
else
|
2956
|
+
deps = deps.dup
|
2957
|
+
hash = dependency_map[deps.shift]
|
2958
|
+
deps.each do |dep|
|
2959
|
+
hash = hash[dep]
|
2960
|
+
end
|
2961
|
+
hash[ta] = {}
|
2962
|
+
end
|
2963
|
+
end
|
2964
|
+
|
2965
|
+
# This mapping is used to make sure that duplicate entries in the
|
2966
|
+
# result set are mapped to a single record. For example, using a
|
2967
|
+
# single one_to_many association with 10 associated records,
|
2968
|
+
# the main object column values appear in the object graph 10 times.
|
2969
|
+
# We map by primary key, if available, or by the object's entire values,
|
2970
|
+
# if not. The mapping must be per table, so create sub maps for each table
|
2971
|
+
# alias.
|
2972
|
+
records_map = {@master=>{}}
|
2973
|
+
alias_map.keys.each{|ta| records_map[ta] = {}}
|
2974
|
+
@records_map = records_map
|
2975
|
+
|
2976
|
+
datasets = opts[:graph][:table_aliases].to_a.reject{|ta,ds| ds.nil?}
|
2977
|
+
column_aliases = opts[:graph_aliases] || opts[:graph][:column_aliases]
|
2978
|
+
primary_keys = {}
|
2979
|
+
column_maps = {}
|
2980
|
+
models = {}
|
2981
|
+
row_procs = {}
|
2982
|
+
datasets.each do |ta, ds|
|
2983
|
+
models[ta] = ds.model
|
2984
|
+
primary_keys[ta] = []
|
2985
|
+
column_maps[ta] = {}
|
2986
|
+
row_procs[ta] = ds.row_proc
|
2987
|
+
end
|
2988
|
+
column_aliases.each do |col_alias, tc|
|
2989
|
+
ta, column = tc
|
2990
|
+
column_maps[ta][col_alias] = column
|
2991
|
+
end
|
2992
|
+
column_maps.each do |ta, h|
|
2993
|
+
pk = models[ta].primary_key
|
2994
|
+
if pk.is_a?(Array)
|
2995
|
+
primary_keys[ta] = []
|
2996
|
+
h.select{|ca, c| primary_keys[ta] << ca if pk.include?(c)}
|
2997
|
+
else
|
2998
|
+
h.select{|ca, c| primary_keys[ta] = ca if pk == c}
|
2999
|
+
end
|
3000
|
+
end
|
3001
|
+
@column_maps = column_maps
|
3002
|
+
@primary_keys = primary_keys
|
3003
|
+
@row_procs = row_procs
|
3004
|
+
|
3005
|
+
# For performance, create two special maps for the master table,
|
3006
|
+
# so you can skip a hash lookup.
|
3007
|
+
@master_column_map = column_maps[master]
|
3008
|
+
@master_primary_keys = primary_keys[master]
|
3009
|
+
|
3010
|
+
# Add a special hash mapping table alias symbols to 5 element arrays that just
|
3011
|
+
# contain the data in other data structures for that table alias. This is
|
3012
|
+
# used for performance, to get all values in one hash lookup instead of
|
3013
|
+
# separate hash lookups for each data structure.
|
3014
|
+
ta_map = {}
|
3015
|
+
alias_map.keys.each do |ta|
|
3016
|
+
ta_map[ta] = [records_map[ta], row_procs[ta], alias_map[ta], type_map[ta], reciprocal_map[ta]]
|
3017
|
+
end
|
3018
|
+
@ta_map = ta_map
|
3019
|
+
end
|
3020
|
+
|
3021
|
+
# Return an array of primary model instances with the associations cache prepopulated
|
3022
|
+
# for all model objects (both primary and associated).
|
3023
|
+
def load(hashes)
|
3024
|
+
master = master()
|
3025
|
+
|
3026
|
+
# Assign to local variables for speed increase
|
3027
|
+
rp = row_procs[master]
|
3028
|
+
rm = records_map[master]
|
3029
|
+
dm = dependency_map
|
3030
|
+
|
3031
|
+
# This will hold the final record set that we will be replacing the object graph with.
|
3032
|
+
records = []
|
3033
|
+
|
3034
|
+
hashes.each do |h|
|
3035
|
+
unless key = master_pk(h)
|
3036
|
+
key = hkey(master_hfor(h))
|
3037
|
+
end
|
3038
|
+
unless primary_record = rm[key]
|
3039
|
+
primary_record = rm[key] = rp.call(master_hfor(h))
|
3040
|
+
# Only add it to the list of records to return if it is a new record
|
3041
|
+
records.push(primary_record)
|
3042
|
+
end
|
3043
|
+
# Build all associations for the current object and it's dependencies
|
3044
|
+
_load(dm, primary_record, h)
|
3045
|
+
end
|
3046
|
+
|
3047
|
+
# Remove duplicate records from all associations if this graph could possibly be a cartesian product
|
3048
|
+
# Run after_load procs if there are any
|
3049
|
+
post_process(records, dm) if @unique || !after_load_map.empty? || !limit_map.empty?
|
3050
|
+
|
3051
|
+
records
|
3052
|
+
end
|
3053
|
+
|
3054
|
+
private
|
3055
|
+
|
3056
|
+
# Recursive method that creates associated model objects and associates them to the current model object.
|
3057
|
+
def _load(dependency_map, current, h)
|
3058
|
+
dependency_map.each do |ta, deps|
|
3059
|
+
unless key = pk(ta, h)
|
3060
|
+
ta_h = hfor(ta, h)
|
3061
|
+
unless ta_h.values.any?
|
3062
|
+
assoc_name = alias_map[ta]
|
3063
|
+
unless (assoc = current.associations).has_key?(assoc_name)
|
3064
|
+
assoc[assoc_name] = type_map[ta] ? [] : nil
|
3065
|
+
end
|
3066
|
+
next
|
3067
|
+
end
|
3068
|
+
key = hkey(ta_h)
|
3069
|
+
end
|
3070
|
+
rm, rp, assoc_name, tm, rcm = @ta_map[ta]
|
3071
|
+
unless rec = rm[key]
|
3072
|
+
rec = rm[key] = rp.call(hfor(ta, h))
|
3073
|
+
end
|
3074
|
+
|
3075
|
+
if tm
|
3076
|
+
unless (assoc = current.associations).has_key?(assoc_name)
|
3077
|
+
assoc[assoc_name] = []
|
3078
|
+
end
|
3079
|
+
assoc[assoc_name].push(rec)
|
3080
|
+
rec.associations[rcm] = current if rcm
|
3081
|
+
else
|
3082
|
+
current.associations[assoc_name] ||= rec
|
3083
|
+
end
|
3084
|
+
# Recurse into dependencies of the current object
|
3085
|
+
_load(deps, rec, h) unless deps.empty?
|
3086
|
+
end
|
3087
|
+
end
|
3088
|
+
|
3089
|
+
# Return the subhash for the specific table alias +ta+ by parsing the values out of the main hash +h+
|
3090
|
+
def hfor(ta, h)
|
3091
|
+
out = {}
|
3092
|
+
@column_maps[ta].each{|ca, c| out[c] = h[ca]}
|
3093
|
+
out
|
3094
|
+
end
|
3095
|
+
|
3096
|
+
# Return a suitable hash key for any subhash +h+, which is an array of values by column order.
|
3097
|
+
# This is only used if the primary key cannot be used.
|
3098
|
+
def hkey(h)
|
3099
|
+
h.sort_by{|x| x[0].to_s}
|
3100
|
+
end
|
3101
|
+
|
3102
|
+
# Return the subhash for the master table by parsing the values out of the main hash +h+
|
3103
|
+
def master_hfor(h)
|
3104
|
+
out = {}
|
3105
|
+
@master_column_map.each{|ca, c| out[c] = h[ca]}
|
3106
|
+
out
|
3107
|
+
end
|
3108
|
+
|
3109
|
+
# Return a primary key value for the master table by parsing it out of the main hash +h+.
|
3110
|
+
def master_pk(h)
|
3111
|
+
x = @master_primary_keys
|
3112
|
+
if x.is_a?(Array)
|
3113
|
+
unless x == []
|
3114
|
+
x = x.map{|ca| h[ca]}
|
3115
|
+
x if x.all?
|
3116
|
+
end
|
3117
|
+
else
|
3118
|
+
h[x]
|
3119
|
+
end
|
3120
|
+
end
|
3121
|
+
|
3122
|
+
# Return a primary key value for the given table alias by parsing it out of the main hash +h+.
|
3123
|
+
def pk(ta, h)
|
3124
|
+
x = primary_keys[ta]
|
3125
|
+
if x.is_a?(Array)
|
3126
|
+
unless x == []
|
3127
|
+
x = x.map{|ca| h[ca]}
|
3128
|
+
x if x.all?
|
3129
|
+
end
|
3130
|
+
else
|
3131
|
+
h[x]
|
3132
|
+
end
|
3133
|
+
end
|
3134
|
+
|
3135
|
+
# If the result set is the result of a cartesian product, then it is possible that
|
3136
|
+
# there are multiple records for each association when there should only be one.
|
3137
|
+
# In that case, for each object in all associations loaded via +eager_graph+, run
|
3138
|
+
# uniq! on the association to make sure no duplicate records show up.
|
3139
|
+
# Note that this can cause legitimate duplicate records to be removed.
|
3140
|
+
def post_process(records, dependency_map)
|
3141
|
+
records.each do |record|
|
3142
|
+
dependency_map.each do |ta, deps|
|
3143
|
+
assoc_name = alias_map[ta]
|
3144
|
+
list = record.send(assoc_name)
|
3145
|
+
rec_list = if type_map[ta]
|
3146
|
+
list.uniq!
|
3147
|
+
if lo = limit_map[ta]
|
3148
|
+
limit, offset = lo
|
3149
|
+
offset ||= 0
|
3150
|
+
if type_map[ta] == :offset
|
3151
|
+
[record.associations[assoc_name] = list[offset]]
|
3152
|
+
else
|
3153
|
+
list.replace(list[(offset)..(limit ? (offset)+limit-1 : -1)] || [])
|
3154
|
+
end
|
3155
|
+
else
|
3156
|
+
list
|
3157
|
+
end
|
3158
|
+
elsif list
|
3159
|
+
[list]
|
3160
|
+
else
|
3161
|
+
[]
|
3162
|
+
end
|
3163
|
+
record.send(:run_association_callbacks, reflection_map[ta], :after_load, list) if after_load_map[ta]
|
3164
|
+
post_process(rec_list, deps) if !rec_list.empty? && !deps.empty?
|
3165
|
+
end
|
3166
|
+
end
|
3167
|
+
end
|
3168
|
+
end
|
3169
|
+
end
|
3170
|
+
end
|
3171
|
+
end
|