backbone-deep-rails 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/lib/backbone/deep/rails/version.rb +1 -1
- metadata +18 -245
- data/vendor/bundle/cache/activemodel-3.2.11.gem +0 -0
- data/vendor/bundle/cache/activesupport-3.2.11.gem +0 -0
- data/vendor/bundle/gems/activesupport-3.2.11/CHANGELOG.md +0 -157
- data/vendor/bundle/gems/activesupport-3.2.11/MIT-LICENSE +0 -20
- data/vendor/bundle/gems/activesupport-3.2.11/README.rdoc +0 -33
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support.rb +0 -82
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/all.rb +0 -3
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/backtrace_cleaner.rb +0 -99
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/base64.rb +0 -54
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/basic_object.rb +0 -21
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/benchmarkable.rb +0 -55
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/buffered_logger.rb +0 -125
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/builder.rb +0 -6
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/cache.rb +0 -638
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/cache/file_store.rb +0 -178
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/cache/mem_cache_store.rb +0 -206
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/cache/memory_store.rb +0 -159
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/cache/null_store.rb +0 -44
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/cache/strategy/local_cache.rb +0 -169
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/callbacks.rb +0 -626
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/concern.rb +0 -131
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/configurable.rb +0 -90
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext.rb +0 -3
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/array.rb +0 -8
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/array/access.rb +0 -46
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/array/conversions.rb +0 -164
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/array/extract_options.rb +0 -29
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/array/grouping.rb +0 -100
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/array/prepend_and_append.rb +0 -7
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/array/random_access.rb +0 -30
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/array/uniq_by.rb +0 -16
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/array/wrap.rb +0 -48
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/benchmark.rb +0 -7
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/big_decimal.rb +0 -1
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/big_decimal/conversions.rb +0 -45
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/class.rb +0 -4
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/class/attribute.rb +0 -115
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/class/attribute_accessors.rb +0 -168
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/class/delegating_attributes.rb +0 -44
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/class/subclasses.rb +0 -36
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/date/acts_like.rb +0 -8
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/date/calculations.rb +0 -276
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/date/conversions.rb +0 -106
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/date/freeze.rb +0 -33
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/date/zones.rb +0 -14
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/date_time/acts_like.rb +0 -13
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/date_time/calculations.rb +0 -143
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/date_time/conversions.rb +0 -103
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/date_time/zones.rb +0 -21
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/enumerable.rb +0 -127
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/exception.rb +0 -3
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/file.rb +0 -2
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/file/atomic.rb +0 -42
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/file/path.rb +0 -5
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/float.rb +0 -1
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/float/rounding.rb +0 -19
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/hash.rb +0 -9
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/hash/conversions.rb +0 -175
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/hash/deep_dup.rb +0 -18
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/hash/deep_merge.rb +0 -21
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/hash/diff.rb +0 -13
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/hash/except.rb +0 -23
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/hash/indifferent_access.rb +0 -24
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/hash/keys.rb +0 -54
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/hash/reverse_merge.rb +0 -23
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/hash/slice.rb +0 -40
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/integer.rb +0 -3
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/integer/inflections.rb +0 -17
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/integer/multiple.rb +0 -10
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/integer/time.rb +0 -39
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/io.rb +0 -15
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/kernel.rb +0 -4
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/kernel/agnostics.rb +0 -11
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/kernel/debugger.rb +0 -10
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/kernel/reporting.rb +0 -93
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/kernel/singleton_class.rb +0 -13
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/load_error.rb +0 -23
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/logger.rb +0 -83
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/module.rb +0 -12
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/module/aliasing.rb +0 -70
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/module/anonymous.rb +0 -24
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/module/attr_internal.rb +0 -39
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/module/attribute_accessors.rb +0 -64
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/module/delegation.rb +0 -153
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/module/deprecation.rb +0 -9
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/module/introspection.rb +0 -88
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/module/method_names.rb +0 -14
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/module/qualified_const.rb +0 -64
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/module/reachable.rb +0 -8
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/module/remove_method.rb +0 -16
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/module/synchronization.rb +0 -45
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/name_error.rb +0 -18
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/numeric.rb +0 -2
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/numeric/bytes.rb +0 -44
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/numeric/time.rb +0 -79
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/object.rb +0 -13
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/object/acts_like.rb +0 -10
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/object/blank.rb +0 -121
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/object/conversions.rb +0 -4
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/object/duplicable.rb +0 -119
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/object/inclusion.rb +0 -25
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/object/instance_variables.rb +0 -33
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/object/to_json.rb +0 -19
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/object/to_param.rb +0 -55
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/object/to_query.rb +0 -27
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/object/try.rb +0 -57
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/object/with_options.rb +0 -43
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/proc.rb +0 -14
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/process.rb +0 -1
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/process/daemon.rb +0 -23
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/range.rb +0 -5
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/range/blockless_step.rb +0 -29
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/range/conversions.rb +0 -21
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/range/cover.rb +0 -3
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/range/include_range.rb +0 -21
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/range/overlaps.rb +0 -8
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/regexp.rb +0 -5
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/rexml.rb +0 -46
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string.rb +0 -14
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string/access.rb +0 -99
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string/behavior.rb +0 -6
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string/conversions.rb +0 -66
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string/encoding.rb +0 -11
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string/exclude.rb +0 -11
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string/filters.rb +0 -49
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string/inflections.rb +0 -202
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string/inquiry.rb +0 -13
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string/interpolation.rb +0 -2
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string/multibyte.rb +0 -72
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string/output_safety.rb +0 -186
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string/starts_ends_with.rb +0 -4
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string/strip.rb +0 -26
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string/xchar.rb +0 -18
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/time/acts_like.rb +0 -8
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/time/calculations.rb +0 -360
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/time/conversions.rb +0 -85
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/time/marshal.rb +0 -57
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/time/publicize_conversion_methods.rb +0 -10
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/time/zones.rb +0 -86
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/uri.rb +0 -30
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/dependencies.rb +0 -703
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/dependencies/autoload.rb +0 -50
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/deprecation.rb +0 -18
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/deprecation/behaviors.rb +0 -49
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/deprecation/method_wrappers.rb +0 -29
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/deprecation/proxy_wrappers.rb +0 -81
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/deprecation/reporting.rb +0 -65
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/descendants_tracker.rb +0 -45
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/duration.rb +0 -110
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/file_update_checker.rb +0 -121
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/file_watcher.rb +0 -36
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/gzip.rb +0 -30
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/hash_with_indifferent_access.rb +0 -178
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/i18n.rb +0 -9
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/i18n_railtie.rb +0 -102
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/inflections.rb +0 -63
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/inflector.rb +0 -7
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/inflector/inflections.rb +0 -174
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/inflector/methods.rb +0 -321
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/inflector/transliterate.rb +0 -98
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/json.rb +0 -2
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/json/decoding.rb +0 -79
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/json/encoding.rb +0 -284
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/json/variable.rb +0 -9
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/lazy_load_hooks.rb +0 -46
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/locale/en.yml +0 -36
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/log_subscriber.rb +0 -122
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/log_subscriber/test_helper.rb +0 -101
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/memoizable.rb +0 -116
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/message_encryptor.rb +0 -103
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/message_verifier.rb +0 -74
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/multibyte.rb +0 -44
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/multibyte/chars.rb +0 -476
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/multibyte/exceptions.rb +0 -8
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/multibyte/unicode.rb +0 -393
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/multibyte/utils.rb +0 -60
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/notifications.rb +0 -154
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/notifications/fanout.rb +0 -61
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/notifications/instrumenter.rb +0 -53
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/option_merger.rb +0 -25
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/ordered_hash.rb +0 -222
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/ordered_options.rb +0 -61
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/railtie.rb +0 -59
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/rescuable.rb +0 -115
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/ruby/shim.rb +0 -22
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/string_inquirer.rb +0 -21
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/tagged_logging.rb +0 -80
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/test_case.rb +0 -34
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/testing/assertions.rb +0 -97
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/testing/declarative.rb +0 -40
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/testing/deprecation.rb +0 -55
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/testing/isolation.rb +0 -157
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/testing/mochaing.rb +0 -7
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/testing/pending.rb +0 -52
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/testing/performance.rb +0 -317
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/testing/performance/jruby.rb +0 -115
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/testing/performance/rubinius.rb +0 -113
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/testing/performance/ruby.rb +0 -152
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/testing/performance/ruby/mri.rb +0 -57
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/testing/performance/ruby/yarv.rb +0 -57
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/testing/setup_and_teardown.rb +0 -118
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/time.rb +0 -35
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/time/autoload.rb +0 -5
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/time_with_zone.rb +0 -358
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/values/time_zone.rb +0 -397
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/values/unicode_tables.dat +0 -0
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/version.rb +0 -10
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/whiny_nil.rb +0 -24
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/xml_mini.rb +0 -168
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/xml_mini/jdom.rb +0 -175
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/xml_mini/libxml.rb +0 -80
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/xml_mini/libxmlsax.rb +0 -86
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/xml_mini/nokogiri.rb +0 -84
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/xml_mini/nokogirisax.rb +0 -88
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/xml_mini/rexml.rb +0 -130
- data/vendor/bundle/specifications/activesupport-3.2.11.gemspec +0 -33
@@ -1,397 +0,0 @@
|
|
1
|
-
require 'active_support/core_ext/object/blank'
|
2
|
-
require 'active_support/core_ext/object/try'
|
3
|
-
|
4
|
-
# The TimeZone class serves as a wrapper around TZInfo::Timezone instances. It allows us to do the following:
|
5
|
-
#
|
6
|
-
# * Limit the set of zones provided by TZInfo to a meaningful subset of 142 zones.
|
7
|
-
# * Retrieve and display zones with a friendlier name (e.g., "Eastern Time (US & Canada)" instead of "America/New_York").
|
8
|
-
# * Lazily load TZInfo::Timezone instances only when they're needed.
|
9
|
-
# * Create ActiveSupport::TimeWithZone instances via TimeZone's +local+, +parse+, +at+ and +now+ methods.
|
10
|
-
#
|
11
|
-
# If you set <tt>config.time_zone</tt> in the Rails Application, you can access this TimeZone object via <tt>Time.zone</tt>:
|
12
|
-
#
|
13
|
-
# # application.rb:
|
14
|
-
# class Application < Rails::Application
|
15
|
-
# config.time_zone = "Eastern Time (US & Canada)"
|
16
|
-
# end
|
17
|
-
#
|
18
|
-
# Time.zone # => #<TimeZone:0x514834...>
|
19
|
-
# Time.zone.name # => "Eastern Time (US & Canada)"
|
20
|
-
# Time.zone.now # => Sun, 18 May 2008 14:30:44 EDT -04:00
|
21
|
-
#
|
22
|
-
# The version of TZInfo bundled with Active Support only includes the definitions necessary to support the zones
|
23
|
-
# defined by the TimeZone class. If you need to use zones that aren't defined by TimeZone, you'll need to install the TZInfo gem
|
24
|
-
# (if a recent version of the gem is installed locally, this will be used instead of the bundled version.)
|
25
|
-
module ActiveSupport
|
26
|
-
class TimeZone
|
27
|
-
# Keys are Rails TimeZone names, values are TZInfo identifiers
|
28
|
-
MAPPING = {
|
29
|
-
"International Date Line West" => "Pacific/Midway",
|
30
|
-
"Midway Island" => "Pacific/Midway",
|
31
|
-
"American Samoa" => "Pacific/Pago_Pago",
|
32
|
-
"Hawaii" => "Pacific/Honolulu",
|
33
|
-
"Alaska" => "America/Juneau",
|
34
|
-
"Pacific Time (US & Canada)" => "America/Los_Angeles",
|
35
|
-
"Tijuana" => "America/Tijuana",
|
36
|
-
"Mountain Time (US & Canada)" => "America/Denver",
|
37
|
-
"Arizona" => "America/Phoenix",
|
38
|
-
"Chihuahua" => "America/Chihuahua",
|
39
|
-
"Mazatlan" => "America/Mazatlan",
|
40
|
-
"Central Time (US & Canada)" => "America/Chicago",
|
41
|
-
"Saskatchewan" => "America/Regina",
|
42
|
-
"Guadalajara" => "America/Mexico_City",
|
43
|
-
"Mexico City" => "America/Mexico_City",
|
44
|
-
"Monterrey" => "America/Monterrey",
|
45
|
-
"Central America" => "America/Guatemala",
|
46
|
-
"Eastern Time (US & Canada)" => "America/New_York",
|
47
|
-
"Indiana (East)" => "America/Indiana/Indianapolis",
|
48
|
-
"Bogota" => "America/Bogota",
|
49
|
-
"Lima" => "America/Lima",
|
50
|
-
"Quito" => "America/Lima",
|
51
|
-
"Atlantic Time (Canada)" => "America/Halifax",
|
52
|
-
"Caracas" => "America/Caracas",
|
53
|
-
"La Paz" => "America/La_Paz",
|
54
|
-
"Santiago" => "America/Santiago",
|
55
|
-
"Newfoundland" => "America/St_Johns",
|
56
|
-
"Brasilia" => "America/Sao_Paulo",
|
57
|
-
"Buenos Aires" => "America/Argentina/Buenos_Aires",
|
58
|
-
"Georgetown" => "America/Guyana",
|
59
|
-
"Greenland" => "America/Godthab",
|
60
|
-
"Mid-Atlantic" => "Atlantic/South_Georgia",
|
61
|
-
"Azores" => "Atlantic/Azores",
|
62
|
-
"Cape Verde Is." => "Atlantic/Cape_Verde",
|
63
|
-
"Dublin" => "Europe/Dublin",
|
64
|
-
"Edinburgh" => "Europe/London",
|
65
|
-
"Lisbon" => "Europe/Lisbon",
|
66
|
-
"London" => "Europe/London",
|
67
|
-
"Casablanca" => "Africa/Casablanca",
|
68
|
-
"Monrovia" => "Africa/Monrovia",
|
69
|
-
"UTC" => "Etc/UTC",
|
70
|
-
"Belgrade" => "Europe/Belgrade",
|
71
|
-
"Bratislava" => "Europe/Bratislava",
|
72
|
-
"Budapest" => "Europe/Budapest",
|
73
|
-
"Ljubljana" => "Europe/Ljubljana",
|
74
|
-
"Prague" => "Europe/Prague",
|
75
|
-
"Sarajevo" => "Europe/Sarajevo",
|
76
|
-
"Skopje" => "Europe/Skopje",
|
77
|
-
"Warsaw" => "Europe/Warsaw",
|
78
|
-
"Zagreb" => "Europe/Zagreb",
|
79
|
-
"Brussels" => "Europe/Brussels",
|
80
|
-
"Copenhagen" => "Europe/Copenhagen",
|
81
|
-
"Madrid" => "Europe/Madrid",
|
82
|
-
"Paris" => "Europe/Paris",
|
83
|
-
"Amsterdam" => "Europe/Amsterdam",
|
84
|
-
"Berlin" => "Europe/Berlin",
|
85
|
-
"Bern" => "Europe/Berlin",
|
86
|
-
"Rome" => "Europe/Rome",
|
87
|
-
"Stockholm" => "Europe/Stockholm",
|
88
|
-
"Vienna" => "Europe/Vienna",
|
89
|
-
"West Central Africa" => "Africa/Algiers",
|
90
|
-
"Bucharest" => "Europe/Bucharest",
|
91
|
-
"Cairo" => "Africa/Cairo",
|
92
|
-
"Helsinki" => "Europe/Helsinki",
|
93
|
-
"Kyiv" => "Europe/Kiev",
|
94
|
-
"Riga" => "Europe/Riga",
|
95
|
-
"Sofia" => "Europe/Sofia",
|
96
|
-
"Tallinn" => "Europe/Tallinn",
|
97
|
-
"Vilnius" => "Europe/Vilnius",
|
98
|
-
"Athens" => "Europe/Athens",
|
99
|
-
"Istanbul" => "Europe/Istanbul",
|
100
|
-
"Minsk" => "Europe/Minsk",
|
101
|
-
"Jerusalem" => "Asia/Jerusalem",
|
102
|
-
"Harare" => "Africa/Harare",
|
103
|
-
"Pretoria" => "Africa/Johannesburg",
|
104
|
-
"Moscow" => "Europe/Moscow",
|
105
|
-
"St. Petersburg" => "Europe/Moscow",
|
106
|
-
"Volgograd" => "Europe/Moscow",
|
107
|
-
"Kuwait" => "Asia/Kuwait",
|
108
|
-
"Riyadh" => "Asia/Riyadh",
|
109
|
-
"Nairobi" => "Africa/Nairobi",
|
110
|
-
"Baghdad" => "Asia/Baghdad",
|
111
|
-
"Tehran" => "Asia/Tehran",
|
112
|
-
"Abu Dhabi" => "Asia/Muscat",
|
113
|
-
"Muscat" => "Asia/Muscat",
|
114
|
-
"Baku" => "Asia/Baku",
|
115
|
-
"Tbilisi" => "Asia/Tbilisi",
|
116
|
-
"Yerevan" => "Asia/Yerevan",
|
117
|
-
"Kabul" => "Asia/Kabul",
|
118
|
-
"Ekaterinburg" => "Asia/Yekaterinburg",
|
119
|
-
"Islamabad" => "Asia/Karachi",
|
120
|
-
"Karachi" => "Asia/Karachi",
|
121
|
-
"Tashkent" => "Asia/Tashkent",
|
122
|
-
"Chennai" => "Asia/Kolkata",
|
123
|
-
"Kolkata" => "Asia/Kolkata",
|
124
|
-
"Mumbai" => "Asia/Kolkata",
|
125
|
-
"New Delhi" => "Asia/Kolkata",
|
126
|
-
"Kathmandu" => "Asia/Kathmandu",
|
127
|
-
"Astana" => "Asia/Dhaka",
|
128
|
-
"Dhaka" => "Asia/Dhaka",
|
129
|
-
"Sri Jayawardenepura" => "Asia/Colombo",
|
130
|
-
"Almaty" => "Asia/Almaty",
|
131
|
-
"Novosibirsk" => "Asia/Novosibirsk",
|
132
|
-
"Rangoon" => "Asia/Rangoon",
|
133
|
-
"Bangkok" => "Asia/Bangkok",
|
134
|
-
"Hanoi" => "Asia/Bangkok",
|
135
|
-
"Jakarta" => "Asia/Jakarta",
|
136
|
-
"Krasnoyarsk" => "Asia/Krasnoyarsk",
|
137
|
-
"Beijing" => "Asia/Shanghai",
|
138
|
-
"Chongqing" => "Asia/Chongqing",
|
139
|
-
"Hong Kong" => "Asia/Hong_Kong",
|
140
|
-
"Urumqi" => "Asia/Urumqi",
|
141
|
-
"Kuala Lumpur" => "Asia/Kuala_Lumpur",
|
142
|
-
"Singapore" => "Asia/Singapore",
|
143
|
-
"Taipei" => "Asia/Taipei",
|
144
|
-
"Perth" => "Australia/Perth",
|
145
|
-
"Irkutsk" => "Asia/Irkutsk",
|
146
|
-
"Ulaan Bataar" => "Asia/Ulaanbaatar",
|
147
|
-
"Seoul" => "Asia/Seoul",
|
148
|
-
"Osaka" => "Asia/Tokyo",
|
149
|
-
"Sapporo" => "Asia/Tokyo",
|
150
|
-
"Tokyo" => "Asia/Tokyo",
|
151
|
-
"Yakutsk" => "Asia/Yakutsk",
|
152
|
-
"Darwin" => "Australia/Darwin",
|
153
|
-
"Adelaide" => "Australia/Adelaide",
|
154
|
-
"Canberra" => "Australia/Melbourne",
|
155
|
-
"Melbourne" => "Australia/Melbourne",
|
156
|
-
"Sydney" => "Australia/Sydney",
|
157
|
-
"Brisbane" => "Australia/Brisbane",
|
158
|
-
"Hobart" => "Australia/Hobart",
|
159
|
-
"Vladivostok" => "Asia/Vladivostok",
|
160
|
-
"Guam" => "Pacific/Guam",
|
161
|
-
"Port Moresby" => "Pacific/Port_Moresby",
|
162
|
-
"Magadan" => "Asia/Magadan",
|
163
|
-
"Solomon Is." => "Asia/Magadan",
|
164
|
-
"New Caledonia" => "Pacific/Noumea",
|
165
|
-
"Fiji" => "Pacific/Fiji",
|
166
|
-
"Kamchatka" => "Asia/Kamchatka",
|
167
|
-
"Marshall Is." => "Pacific/Majuro",
|
168
|
-
"Auckland" => "Pacific/Auckland",
|
169
|
-
"Wellington" => "Pacific/Auckland",
|
170
|
-
"Nuku'alofa" => "Pacific/Tongatapu",
|
171
|
-
"Tokelau Is." => "Pacific/Fakaofo",
|
172
|
-
"Samoa" => "Pacific/Apia"
|
173
|
-
}.each { |name, zone| name.freeze; zone.freeze }
|
174
|
-
MAPPING.freeze
|
175
|
-
|
176
|
-
UTC_OFFSET_WITH_COLON = '%s%02d:%02d'
|
177
|
-
UTC_OFFSET_WITHOUT_COLON = UTC_OFFSET_WITH_COLON.sub(':', '')
|
178
|
-
|
179
|
-
# Assumes self represents an offset from UTC in seconds (as returned from Time#utc_offset)
|
180
|
-
# and turns this into an +HH:MM formatted string. Example:
|
181
|
-
#
|
182
|
-
# TimeZone.seconds_to_utc_offset(-21_600) # => "-06:00"
|
183
|
-
def self.seconds_to_utc_offset(seconds, colon = true)
|
184
|
-
format = colon ? UTC_OFFSET_WITH_COLON : UTC_OFFSET_WITHOUT_COLON
|
185
|
-
sign = (seconds < 0 ? '-' : '+')
|
186
|
-
hours = seconds.abs / 3600
|
187
|
-
minutes = (seconds.abs % 3600) / 60
|
188
|
-
format % [sign, hours, minutes]
|
189
|
-
end
|
190
|
-
|
191
|
-
include Comparable
|
192
|
-
attr_reader :name
|
193
|
-
attr_reader :tzinfo
|
194
|
-
|
195
|
-
# Create a new TimeZone object with the given name and offset. The
|
196
|
-
# offset is the number of seconds that this time zone is offset from UTC
|
197
|
-
# (GMT). Seconds were chosen as the offset unit because that is the unit that
|
198
|
-
# Ruby uses to represent time zone offsets (see Time#utc_offset).
|
199
|
-
def initialize(name, utc_offset = nil, tzinfo = nil)
|
200
|
-
self.class.send(:require_tzinfo)
|
201
|
-
|
202
|
-
@name = name
|
203
|
-
@utc_offset = utc_offset
|
204
|
-
@tzinfo = tzinfo || TimeZone.find_tzinfo(name)
|
205
|
-
@current_period = nil
|
206
|
-
end
|
207
|
-
|
208
|
-
def utc_offset
|
209
|
-
if @utc_offset
|
210
|
-
@utc_offset
|
211
|
-
else
|
212
|
-
@current_period ||= tzinfo.try(:current_period)
|
213
|
-
@current_period.try(:utc_offset)
|
214
|
-
end
|
215
|
-
end
|
216
|
-
|
217
|
-
# Returns the offset of this time zone as a formatted string, of the
|
218
|
-
# format "+HH:MM".
|
219
|
-
def formatted_offset(colon=true, alternate_utc_string = nil)
|
220
|
-
utc_offset == 0 && alternate_utc_string || self.class.seconds_to_utc_offset(utc_offset, colon)
|
221
|
-
end
|
222
|
-
|
223
|
-
# Compare this time zone to the parameter. The two are compared first on
|
224
|
-
# their offsets, and then by name.
|
225
|
-
def <=>(zone)
|
226
|
-
result = (utc_offset <=> zone.utc_offset)
|
227
|
-
result = (name <=> zone.name) if result == 0
|
228
|
-
result
|
229
|
-
end
|
230
|
-
|
231
|
-
# Compare #name and TZInfo identifier to a supplied regexp, returning true
|
232
|
-
# if a match is found.
|
233
|
-
def =~(re)
|
234
|
-
return true if name =~ re || MAPPING[name] =~ re
|
235
|
-
end
|
236
|
-
|
237
|
-
# Returns a textual representation of this time zone.
|
238
|
-
def to_s
|
239
|
-
"(GMT#{formatted_offset}) #{name}"
|
240
|
-
end
|
241
|
-
|
242
|
-
# Method for creating new ActiveSupport::TimeWithZone instance in time zone of +self+ from given values. Example:
|
243
|
-
#
|
244
|
-
# Time.zone = "Hawaii" # => "Hawaii"
|
245
|
-
# Time.zone.local(2007, 2, 1, 15, 30, 45) # => Thu, 01 Feb 2007 15:30:45 HST -10:00
|
246
|
-
def local(*args)
|
247
|
-
time = Time.utc_time(*args)
|
248
|
-
ActiveSupport::TimeWithZone.new(nil, self, time)
|
249
|
-
end
|
250
|
-
|
251
|
-
# Method for creating new ActiveSupport::TimeWithZone instance in time zone of +self+ from number of seconds since the Unix epoch. Example:
|
252
|
-
#
|
253
|
-
# Time.zone = "Hawaii" # => "Hawaii"
|
254
|
-
# Time.utc(2000).to_f # => 946684800.0
|
255
|
-
# Time.zone.at(946684800.0) # => Fri, 31 Dec 1999 14:00:00 HST -10:00
|
256
|
-
def at(secs)
|
257
|
-
utc = Time.at(secs).utc rescue DateTime.civil(1970).since(secs)
|
258
|
-
utc.in_time_zone(self)
|
259
|
-
end
|
260
|
-
|
261
|
-
# Method for creating new ActiveSupport::TimeWithZone instance in time zone of +self+ from parsed string. Example:
|
262
|
-
#
|
263
|
-
# Time.zone = "Hawaii" # => "Hawaii"
|
264
|
-
# Time.zone.parse('1999-12-31 14:00:00') # => Fri, 31 Dec 1999 14:00:00 HST -10:00
|
265
|
-
#
|
266
|
-
# If upper components are missing from the string, they are supplied from TimeZone#now:
|
267
|
-
#
|
268
|
-
# Time.zone.now # => Fri, 31 Dec 1999 14:00:00 HST -10:00
|
269
|
-
# Time.zone.parse('22:30:00') # => Fri, 31 Dec 1999 22:30:00 HST -10:00
|
270
|
-
def parse(str, now=now)
|
271
|
-
date_parts = Date._parse(str)
|
272
|
-
return if date_parts.blank?
|
273
|
-
time = Time.parse(str, now) rescue DateTime.parse(str)
|
274
|
-
if date_parts[:offset].nil?
|
275
|
-
ActiveSupport::TimeWithZone.new(nil, self, time)
|
276
|
-
else
|
277
|
-
time.in_time_zone(self)
|
278
|
-
end
|
279
|
-
end
|
280
|
-
|
281
|
-
# Returns an ActiveSupport::TimeWithZone instance representing the current time
|
282
|
-
# in the time zone represented by +self+. Example:
|
283
|
-
#
|
284
|
-
# Time.zone = 'Hawaii' # => "Hawaii"
|
285
|
-
# Time.zone.now # => Wed, 23 Jan 2008 20:24:27 HST -10:00
|
286
|
-
def now
|
287
|
-
Time.now.utc.in_time_zone(self)
|
288
|
-
end
|
289
|
-
|
290
|
-
# Return the current date in this time zone.
|
291
|
-
def today
|
292
|
-
tzinfo.now.to_date
|
293
|
-
end
|
294
|
-
|
295
|
-
# Adjust the given time to the simultaneous time in the time zone represented by +self+. Returns a
|
296
|
-
# Time.utc() instance -- if you want an ActiveSupport::TimeWithZone instance, use Time#in_time_zone() instead.
|
297
|
-
def utc_to_local(time)
|
298
|
-
tzinfo.utc_to_local(time)
|
299
|
-
end
|
300
|
-
|
301
|
-
# Adjust the given time to the simultaneous time in UTC. Returns a Time.utc() instance.
|
302
|
-
def local_to_utc(time, dst=true)
|
303
|
-
tzinfo.local_to_utc(time, dst)
|
304
|
-
end
|
305
|
-
|
306
|
-
# Available so that TimeZone instances respond like TZInfo::Timezone instances
|
307
|
-
def period_for_utc(time)
|
308
|
-
tzinfo.period_for_utc(time)
|
309
|
-
end
|
310
|
-
|
311
|
-
# Available so that TimeZone instances respond like TZInfo::Timezone instances
|
312
|
-
def period_for_local(time, dst=true)
|
313
|
-
tzinfo.period_for_local(time, dst)
|
314
|
-
end
|
315
|
-
|
316
|
-
def self.find_tzinfo(name)
|
317
|
-
TZInfo::TimezoneProxy.new(MAPPING[name] || name)
|
318
|
-
end
|
319
|
-
|
320
|
-
class << self
|
321
|
-
alias_method :create, :new
|
322
|
-
|
323
|
-
# Return a TimeZone instance with the given name, or +nil+ if no
|
324
|
-
# such TimeZone instance exists. (This exists to support the use of
|
325
|
-
# this class with the +composed_of+ macro.)
|
326
|
-
def new(name)
|
327
|
-
self[name]
|
328
|
-
end
|
329
|
-
|
330
|
-
# Return an array of all TimeZone objects. There are multiple
|
331
|
-
# TimeZone objects per time zone, in many cases, to make it easier
|
332
|
-
# for users to find their own time zone.
|
333
|
-
def all
|
334
|
-
@zones ||= zones_map.values.sort
|
335
|
-
end
|
336
|
-
|
337
|
-
def zones_map
|
338
|
-
@zones_map ||= begin
|
339
|
-
new_zones_names = MAPPING.keys - lazy_zones_map.keys
|
340
|
-
new_zones = Hash[new_zones_names.map { |place| [place, create(place)] }]
|
341
|
-
|
342
|
-
lazy_zones_map.merge(new_zones)
|
343
|
-
end
|
344
|
-
end
|
345
|
-
|
346
|
-
# Locate a specific time zone object. If the argument is a string, it
|
347
|
-
# is interpreted to mean the name of the timezone to locate. If it is a
|
348
|
-
# numeric value it is either the hour offset, or the second offset, of the
|
349
|
-
# timezone to find. (The first one with that offset will be returned.)
|
350
|
-
# Returns +nil+ if no such time zone is known to the system.
|
351
|
-
def [](arg)
|
352
|
-
case arg
|
353
|
-
when String
|
354
|
-
begin
|
355
|
-
lazy_zones_map[arg] ||= lookup(arg).tap { |tz| tz.utc_offset }
|
356
|
-
rescue TZInfo::InvalidTimezoneIdentifier
|
357
|
-
nil
|
358
|
-
end
|
359
|
-
when Numeric, ActiveSupport::Duration
|
360
|
-
arg *= 3600 if arg.abs <= 13
|
361
|
-
all.find { |z| z.utc_offset == arg.to_i }
|
362
|
-
else
|
363
|
-
raise ArgumentError, "invalid argument to TimeZone[]: #{arg.inspect}"
|
364
|
-
end
|
365
|
-
end
|
366
|
-
|
367
|
-
# A convenience method for returning a collection of TimeZone objects
|
368
|
-
# for time zones in the USA.
|
369
|
-
def us_zones
|
370
|
-
@us_zones ||= all.find_all { |z| z.name =~ /US|Arizona|Indiana|Hawaii|Alaska/ }
|
371
|
-
end
|
372
|
-
|
373
|
-
protected
|
374
|
-
|
375
|
-
def require_tzinfo
|
376
|
-
require 'tzinfo' unless defined?(::TZInfo)
|
377
|
-
rescue LoadError
|
378
|
-
$stderr.puts "You don't have tzinfo installed in your application. Please add it to your Gemfile and run bundle install"
|
379
|
-
raise
|
380
|
-
end
|
381
|
-
|
382
|
-
private
|
383
|
-
|
384
|
-
def lookup(name)
|
385
|
-
(tzinfo = find_tzinfo(name)) && create(tzinfo.name.freeze)
|
386
|
-
end
|
387
|
-
|
388
|
-
def lazy_zones_map
|
389
|
-
require_tzinfo
|
390
|
-
|
391
|
-
@lazy_zones_map ||= Hash.new do |hash, place|
|
392
|
-
hash[place] = create(place) if MAPPING.has_key?(place)
|
393
|
-
end
|
394
|
-
end
|
395
|
-
end
|
396
|
-
end
|
397
|
-
end
|
Binary file
|
@@ -1,24 +0,0 @@
|
|
1
|
-
require 'active_support/deprecation'
|
2
|
-
|
3
|
-
# Extensions to +nil+ which allow for more helpful error messages for people who
|
4
|
-
# are new to Rails.
|
5
|
-
#
|
6
|
-
# NilClass#id exists in Ruby 1.8 (though it is deprecated). Since +id+ is a fundamental
|
7
|
-
# method of Active Record models NilClass#id is redefined as well to raise a RuntimeError
|
8
|
-
# and warn the user. She probably wanted a model database identifier and the 4
|
9
|
-
# returned by the original method could result in obscure bugs.
|
10
|
-
#
|
11
|
-
# The flag <tt>config.whiny_nils</tt> determines whether this feature is enabled.
|
12
|
-
# By default it is on in development and test modes, and it is off in production
|
13
|
-
# mode.
|
14
|
-
class NilClass
|
15
|
-
def self.add_whiner(klass)
|
16
|
-
ActiveSupport::Deprecation.warn "NilClass.add_whiner is deprecated and this functionality is " \
|
17
|
-
"removed from Rails versions as it affects Ruby 1.9 performance.", caller
|
18
|
-
end
|
19
|
-
|
20
|
-
# Raises a RuntimeError when you attempt to call +id+ on +nil+.
|
21
|
-
def id
|
22
|
-
raise RuntimeError, "Called id for nil, which would mistakenly be #{object_id} -- if you really wanted the id of nil, use object_id", caller
|
23
|
-
end
|
24
|
-
end
|
@@ -1,168 +0,0 @@
|
|
1
|
-
require 'time'
|
2
|
-
require 'active_support/base64'
|
3
|
-
require 'active_support/core_ext/module/delegation'
|
4
|
-
require 'active_support/core_ext/string/inflections'
|
5
|
-
|
6
|
-
module ActiveSupport
|
7
|
-
# = XmlMini
|
8
|
-
#
|
9
|
-
# To use the much faster libxml parser:
|
10
|
-
# gem 'libxml-ruby', '=0.9.7'
|
11
|
-
# XmlMini.backend = 'LibXML'
|
12
|
-
module XmlMini
|
13
|
-
extend self
|
14
|
-
|
15
|
-
# This module decorates files deserialized using Hash.from_xml with
|
16
|
-
# the <tt>original_filename</tt> and <tt>content_type</tt> methods.
|
17
|
-
module FileLike #:nodoc:
|
18
|
-
attr_writer :original_filename, :content_type
|
19
|
-
|
20
|
-
def original_filename
|
21
|
-
@original_filename || 'untitled'
|
22
|
-
end
|
23
|
-
|
24
|
-
def content_type
|
25
|
-
@content_type || 'application/octet-stream'
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
DEFAULT_ENCODINGS = {
|
30
|
-
"binary" => "base64"
|
31
|
-
} unless defined?(DEFAULT_ENCODINGS)
|
32
|
-
|
33
|
-
TYPE_NAMES = {
|
34
|
-
"Symbol" => "symbol",
|
35
|
-
"Fixnum" => "integer",
|
36
|
-
"Bignum" => "integer",
|
37
|
-
"BigDecimal" => "decimal",
|
38
|
-
"Float" => "float",
|
39
|
-
"TrueClass" => "boolean",
|
40
|
-
"FalseClass" => "boolean",
|
41
|
-
"Date" => "date",
|
42
|
-
"DateTime" => "datetime",
|
43
|
-
"Time" => "datetime",
|
44
|
-
"Array" => "array",
|
45
|
-
"Hash" => "hash"
|
46
|
-
} unless defined?(TYPE_NAMES)
|
47
|
-
|
48
|
-
FORMATTING = {
|
49
|
-
"symbol" => Proc.new { |symbol| symbol.to_s },
|
50
|
-
"date" => Proc.new { |date| date.to_s(:db) },
|
51
|
-
"datetime" => Proc.new { |time| time.xmlschema },
|
52
|
-
"binary" => Proc.new { |binary| ::Base64.encode64(binary) },
|
53
|
-
"yaml" => Proc.new { |yaml| yaml.to_yaml }
|
54
|
-
} unless defined?(FORMATTING)
|
55
|
-
|
56
|
-
# TODO use regexp instead of Date.parse
|
57
|
-
unless defined?(PARSING)
|
58
|
-
PARSING = {
|
59
|
-
"symbol" => Proc.new { |symbol| symbol.to_sym },
|
60
|
-
"date" => Proc.new { |date| ::Date.parse(date) },
|
61
|
-
"datetime" => Proc.new { |time| Time.xmlschema(time).utc rescue ::DateTime.parse(time).utc },
|
62
|
-
"integer" => Proc.new { |integer| integer.to_i },
|
63
|
-
"float" => Proc.new { |float| float.to_f },
|
64
|
-
"decimal" => Proc.new { |number| BigDecimal(number) },
|
65
|
-
"boolean" => Proc.new { |boolean| %w(1 true).include?(boolean.strip) },
|
66
|
-
"string" => Proc.new { |string| string.to_s },
|
67
|
-
"yaml" => Proc.new { |yaml| YAML::load(yaml) rescue yaml },
|
68
|
-
"base64Binary" => Proc.new { |bin| ::Base64.decode64(bin) },
|
69
|
-
"binary" => Proc.new { |bin, entity| _parse_binary(bin, entity) },
|
70
|
-
"file" => Proc.new { |file, entity| _parse_file(file, entity) }
|
71
|
-
}
|
72
|
-
|
73
|
-
PARSING.update(
|
74
|
-
"double" => PARSING["float"],
|
75
|
-
"dateTime" => PARSING["datetime"]
|
76
|
-
)
|
77
|
-
end
|
78
|
-
|
79
|
-
attr_reader :backend
|
80
|
-
delegate :parse, :to => :backend
|
81
|
-
|
82
|
-
def backend=(name)
|
83
|
-
if name.is_a?(Module)
|
84
|
-
@backend = name
|
85
|
-
else
|
86
|
-
require "active_support/xml_mini/#{name.to_s.downcase}"
|
87
|
-
@backend = ActiveSupport.const_get("XmlMini_#{name}")
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
def with_backend(name)
|
92
|
-
old_backend, self.backend = backend, name
|
93
|
-
yield
|
94
|
-
ensure
|
95
|
-
self.backend = old_backend
|
96
|
-
end
|
97
|
-
|
98
|
-
def to_tag(key, value, options)
|
99
|
-
type_name = options.delete(:type)
|
100
|
-
merged_options = options.merge(:root => key, :skip_instruct => true)
|
101
|
-
|
102
|
-
if value.is_a?(::Method) || value.is_a?(::Proc)
|
103
|
-
if value.arity == 1
|
104
|
-
value.call(merged_options)
|
105
|
-
else
|
106
|
-
value.call(merged_options, key.to_s.singularize)
|
107
|
-
end
|
108
|
-
elsif value.respond_to?(:to_xml)
|
109
|
-
value.to_xml(merged_options)
|
110
|
-
else
|
111
|
-
type_name ||= TYPE_NAMES[value.class.name]
|
112
|
-
type_name ||= value.class.name if value && !value.respond_to?(:to_str)
|
113
|
-
type_name = type_name.to_s if type_name
|
114
|
-
|
115
|
-
key = rename_key(key.to_s, options)
|
116
|
-
|
117
|
-
attributes = options[:skip_types] || type_name.nil? ? { } : { :type => type_name }
|
118
|
-
attributes[:nil] = true if value.nil?
|
119
|
-
|
120
|
-
encoding = options[:encoding] || DEFAULT_ENCODINGS[type_name]
|
121
|
-
attributes[:encoding] = encoding if encoding
|
122
|
-
|
123
|
-
formatted_value = FORMATTING[type_name] && !value.nil? ?
|
124
|
-
FORMATTING[type_name].call(value) : value
|
125
|
-
|
126
|
-
options[:builder].tag!(key, formatted_value, attributes)
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
def rename_key(key, options = {})
|
131
|
-
camelize = options[:camelize]
|
132
|
-
dasherize = !options.has_key?(:dasherize) || options[:dasherize]
|
133
|
-
if camelize
|
134
|
-
key = true == camelize ? key.camelize : key.camelize(camelize)
|
135
|
-
end
|
136
|
-
key = _dasherize(key) if dasherize
|
137
|
-
key
|
138
|
-
end
|
139
|
-
|
140
|
-
protected
|
141
|
-
|
142
|
-
def _dasherize(key)
|
143
|
-
# $2 must be a non-greedy regex for this to work
|
144
|
-
left, middle, right = /\A(_*)(.*?)(_*)\Z/.match(key.strip)[1,3]
|
145
|
-
"#{left}#{middle.tr('_ ', '--')}#{right}"
|
146
|
-
end
|
147
|
-
|
148
|
-
# TODO: Add support for other encodings
|
149
|
-
def _parse_binary(bin, entity) #:nodoc:
|
150
|
-
case entity['encoding']
|
151
|
-
when 'base64'
|
152
|
-
::Base64.decode64(bin)
|
153
|
-
else
|
154
|
-
bin
|
155
|
-
end
|
156
|
-
end
|
157
|
-
|
158
|
-
def _parse_file(file, entity)
|
159
|
-
f = StringIO.new(::Base64.decode64(file))
|
160
|
-
f.extend(FileLike)
|
161
|
-
f.original_filename = entity['name']
|
162
|
-
f.content_type = entity['content_type']
|
163
|
-
f
|
164
|
-
end
|
165
|
-
end
|
166
|
-
|
167
|
-
XmlMini.backend = 'REXML'
|
168
|
-
end
|