mack-active_record 0.8.2 → 0.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/mack-active_record/test_extensions.rb +0 -3
- metadata +3 -374
- data/lib/gems/activesupport-2.2.2/lib/active_support/base64.rb +0 -33
- data/lib/gems/activesupport-2.2.2/lib/active_support/basic_object.rb +0 -24
- data/lib/gems/activesupport-2.2.2/lib/active_support/buffered_logger.rb +0 -122
- data/lib/gems/activesupport-2.2.2/lib/active_support/cache/compressed_mem_cache_store.rb +0 -20
- data/lib/gems/activesupport-2.2.2/lib/active_support/cache/drb_store.rb +0 -15
- data/lib/gems/activesupport-2.2.2/lib/active_support/cache/file_store.rb +0 -72
- data/lib/gems/activesupport-2.2.2/lib/active_support/cache/mem_cache_store.rb +0 -127
- data/lib/gems/activesupport-2.2.2/lib/active_support/cache/memory_store.rb +0 -52
- data/lib/gems/activesupport-2.2.2/lib/active_support/cache/synchronized_memory_store.rb +0 -47
- data/lib/gems/activesupport-2.2.2/lib/active_support/cache.rb +0 -223
- data/lib/gems/activesupport-2.2.2/lib/active_support/callbacks.rb +0 -280
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/array/access.rb +0 -53
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/array/conversions.rb +0 -183
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/array/extract_options.rb +0 -20
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/array/grouping.rb +0 -106
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/array/random_access.rb +0 -12
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/array.rb +0 -13
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/base64/encoding.rb +0 -16
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/base64.rb +0 -4
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/benchmark.rb +0 -12
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/bigdecimal/conversions.rb +0 -37
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/bigdecimal.rb +0 -6
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/blank.rb +0 -58
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/cgi/escape_skipping_slashes.rb +0 -14
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/cgi.rb +0 -5
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/class/attribute_accessors.rb +0 -54
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/class/delegating_attributes.rb +0 -46
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/class/inheritable_attributes.rb +0 -140
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/class/removal.rb +0 -50
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/class.rb +0 -4
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/date/behavior.rb +0 -42
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/date/calculations.rb +0 -230
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/date/conversions.rb +0 -107
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/date.rb +0 -10
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/date_time/calculations.rb +0 -126
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/date_time/conversions.rb +0 -96
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/date_time.rb +0 -12
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/duplicable.rb +0 -43
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/enumerable.rb +0 -107
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/exception.rb +0 -41
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/file/atomic.rb +0 -46
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/file.rb +0 -5
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/float/rounding.rb +0 -24
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/float/time.rb +0 -27
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/float.rb +0 -7
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/hash/conversions.rb +0 -259
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/hash/deep_merge.rb +0 -23
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/hash/diff.rb +0 -19
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/hash/except.rb +0 -25
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/hash/indifferent_access.rb +0 -137
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/hash/keys.rb +0 -52
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/hash/reverse_merge.rb +0 -35
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/hash/slice.rb +0 -33
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/hash.rb +0 -14
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/integer/even_odd.rb +0 -29
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/integer/inflections.rb +0 -20
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/integer/time.rb +0 -45
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/integer.rb +0 -9
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/kernel/agnostics.rb +0 -11
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/kernel/daemonizing.rb +0 -7
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/kernel/debugger.rb +0 -13
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/kernel/reporting.rb +0 -59
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/kernel/requires.rb +0 -24
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/kernel.rb +0 -5
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/load_error.rb +0 -38
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/logger.rb +0 -143
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/module/aliasing.rb +0 -74
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/module/attr_accessor_with_default.rb +0 -31
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/module/attr_internal.rb +0 -32
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/module/attribute_accessors.rb +0 -58
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/module/delegation.rb +0 -95
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/module/inclusion.rb +0 -30
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/module/introspection.rb +0 -90
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/module/loading.rb +0 -23
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/module/model_naming.rb +0 -23
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/module/synchronization.rb +0 -39
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/module.rb +0 -23
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/name_error.rb +0 -17
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/numeric/bytes.rb +0 -44
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/numeric/conversions.rb +0 -19
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/numeric/time.rb +0 -81
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/numeric.rb +0 -9
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/object/conversions.rb +0 -14
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/object/extending.rb +0 -80
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/object/instance_variables.rb +0 -74
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/object/metaclass.rb +0 -13
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/object/misc.rb +0 -74
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/object.rb +0 -5
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/pathname/clean_within.rb +0 -14
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/pathname.rb +0 -7
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/proc.rb +0 -12
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/process/daemon.rb +0 -25
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/process.rb +0 -1
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/range/blockless_step.rb +0 -32
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/range/conversions.rb +0 -27
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/range/include_range.rb +0 -30
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/range/overlaps.rb +0 -15
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/range.rb +0 -11
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/rexml.rb +0 -36
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/string/access.rb +0 -82
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/string/behavior.rb +0 -13
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/string/conversions.rb +0 -28
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/string/filters.rb +0 -26
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/string/inflections.rb +0 -167
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/string/iterators.rb +0 -21
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/string/multibyte.rb +0 -81
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/string/starts_ends_with.rb +0 -35
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/string/xchar.rb +0 -11
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/string.rb +0 -22
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/symbol.rb +0 -14
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/time/behavior.rb +0 -13
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/time/calculations.rb +0 -303
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/time/conversions.rb +0 -90
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/time/zones.rb +0 -86
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/time.rb +0 -42
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext.rb +0 -4
- data/lib/gems/activesupport-2.2.2/lib/active_support/dependencies.rb +0 -621
- data/lib/gems/activesupport-2.2.2/lib/active_support/deprecation.rb +0 -243
- data/lib/gems/activesupport-2.2.2/lib/active_support/duration.rb +0 -96
- data/lib/gems/activesupport-2.2.2/lib/active_support/gzip.rb +0 -25
- data/lib/gems/activesupport-2.2.2/lib/active_support/inflections.rb +0 -55
- data/lib/gems/activesupport-2.2.2/lib/active_support/inflector.rb +0 -397
- data/lib/gems/activesupport-2.2.2/lib/active_support/json/decoding.rb +0 -63
- data/lib/gems/activesupport-2.2.2/lib/active_support/json/encoders/date.rb +0 -21
- data/lib/gems/activesupport-2.2.2/lib/active_support/json/encoders/date_time.rb +0 -21
- data/lib/gems/activesupport-2.2.2/lib/active_support/json/encoders/enumerable.rb +0 -12
- data/lib/gems/activesupport-2.2.2/lib/active_support/json/encoders/false_class.rb +0 -5
- data/lib/gems/activesupport-2.2.2/lib/active_support/json/encoders/hash.rb +0 -47
- data/lib/gems/activesupport-2.2.2/lib/active_support/json/encoders/nil_class.rb +0 -5
- data/lib/gems/activesupport-2.2.2/lib/active_support/json/encoders/numeric.rb +0 -5
- data/lib/gems/activesupport-2.2.2/lib/active_support/json/encoders/object.rb +0 -6
- data/lib/gems/activesupport-2.2.2/lib/active_support/json/encoders/regexp.rb +0 -5
- data/lib/gems/activesupport-2.2.2/lib/active_support/json/encoders/string.rb +0 -36
- data/lib/gems/activesupport-2.2.2/lib/active_support/json/encoders/symbol.rb +0 -5
- data/lib/gems/activesupport-2.2.2/lib/active_support/json/encoders/time.rb +0 -21
- data/lib/gems/activesupport-2.2.2/lib/active_support/json/encoders/true_class.rb +0 -5
- data/lib/gems/activesupport-2.2.2/lib/active_support/json/encoding.rb +0 -37
- data/lib/gems/activesupport-2.2.2/lib/active_support/json/variable.rb +0 -10
- data/lib/gems/activesupport-2.2.2/lib/active_support/json.rb +0 -23
- data/lib/gems/activesupport-2.2.2/lib/active_support/locale/en.yml +0 -32
- data/lib/gems/activesupport-2.2.2/lib/active_support/memoizable.rb +0 -82
- data/lib/gems/activesupport-2.2.2/lib/active_support/multibyte/chars.rb +0 -679
- data/lib/gems/activesupport-2.2.2/lib/active_support/multibyte/exceptions.rb +0 -8
- data/lib/gems/activesupport-2.2.2/lib/active_support/multibyte/unicode_database.rb +0 -71
- data/lib/gems/activesupport-2.2.2/lib/active_support/multibyte.rb +0 -33
- data/lib/gems/activesupport-2.2.2/lib/active_support/option_merger.rb +0 -17
- data/lib/gems/activesupport-2.2.2/lib/active_support/ordered_hash.rb +0 -58
- data/lib/gems/activesupport-2.2.2/lib/active_support/ordered_options.rb +0 -19
- data/lib/gems/activesupport-2.2.2/lib/active_support/rescuable.rb +0 -108
- data/lib/gems/activesupport-2.2.2/lib/active_support/secure_random.rb +0 -197
- data/lib/gems/activesupport-2.2.2/lib/active_support/string_inquirer.rb +0 -21
- data/lib/gems/activesupport-2.2.2/lib/active_support/test_case.rb +0 -24
- data/lib/gems/activesupport-2.2.2/lib/active_support/testing/core_ext/test/unit/assertions.rb +0 -72
- data/lib/gems/activesupport-2.2.2/lib/active_support/testing/core_ext/test.rb +0 -6
- data/lib/gems/activesupport-2.2.2/lib/active_support/testing/default.rb +0 -9
- data/lib/gems/activesupport-2.2.2/lib/active_support/testing/performance.rb +0 -452
- data/lib/gems/activesupport-2.2.2/lib/active_support/testing/setup_and_teardown.rb +0 -120
- data/lib/gems/activesupport-2.2.2/lib/active_support/time_with_zone.rb +0 -328
- data/lib/gems/activesupport-2.2.2/lib/active_support/values/time_zone.rb +0 -403
- data/lib/gems/activesupport-2.2.2/lib/active_support/values/unicode_tables.dat +0 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/builder-2.1.2/blankslate.rb +0 -113
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/builder-2.1.2/builder/blankslate.rb +0 -20
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/builder-2.1.2/builder/css.rb +0 -250
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/builder-2.1.2/builder/xchar.rb +0 -115
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/builder-2.1.2/builder/xmlbase.rb +0 -139
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/builder-2.1.2/builder/xmlevents.rb +0 -63
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/builder-2.1.2/builder/xmlmarkup.rb +0 -328
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/builder-2.1.2/builder.rb +0 -13
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb +0 -216
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/i18n-0.0.1/i18n/exceptions.rb +0 -53
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/i18n-0.0.1/i18n.rb +0 -194
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/memcache-client-1.5.1/memcache.rb +0 -849
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/data_timezone.rb +0 -47
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/data_timezone_info.rb +0 -228
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Algiers.rb +0 -55
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Cairo.rb +0 -219
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Casablanca.rb +0 -40
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Harare.rb +0 -18
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Johannesburg.rb +0 -25
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Monrovia.rb +0 -22
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Nairobi.rb +0 -23
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Argentina/Buenos_Aires.rb +0 -166
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Argentina/San_Juan.rb +0 -86
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Bogota.rb +0 -23
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Caracas.rb +0 -23
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Chicago.rb +0 -283
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Chihuahua.rb +0 -136
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Denver.rb +0 -204
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Godthab.rb +0 -161
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Guatemala.rb +0 -27
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Halifax.rb +0 -274
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Indiana/Indianapolis.rb +0 -149
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Juneau.rb +0 -194
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/La_Paz.rb +0 -22
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Lima.rb +0 -35
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Los_Angeles.rb +0 -232
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Mazatlan.rb +0 -139
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Mexico_City.rb +0 -144
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Monterrey.rb +0 -131
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/New_York.rb +0 -282
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Phoenix.rb +0 -30
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Regina.rb +0 -74
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Santiago.rb +0 -205
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Sao_Paulo.rb +0 -171
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/St_Johns.rb +0 -288
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Tijuana.rb +0 -196
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Almaty.rb +0 -67
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Baghdad.rb +0 -73
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Baku.rb +0 -161
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Bangkok.rb +0 -20
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Chongqing.rb +0 -33
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Colombo.rb +0 -30
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Dhaka.rb +0 -27
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Hong_Kong.rb +0 -87
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Irkutsk.rb +0 -165
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Jakarta.rb +0 -30
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Jerusalem.rb +0 -163
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kabul.rb +0 -20
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kamchatka.rb +0 -163
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Karachi.rb +0 -30
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Katmandu.rb +0 -20
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kolkata.rb +0 -25
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Krasnoyarsk.rb +0 -163
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kuala_Lumpur.rb +0 -31
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kuwait.rb +0 -18
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Magadan.rb +0 -163
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Muscat.rb +0 -18
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Novosibirsk.rb +0 -164
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Rangoon.rb +0 -24
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Riyadh.rb +0 -18
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Seoul.rb +0 -34
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Shanghai.rb +0 -35
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Singapore.rb +0 -33
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Taipei.rb +0 -59
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Tashkent.rb +0 -47
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Tbilisi.rb +0 -78
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Tehran.rb +0 -121
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Tokyo.rb +0 -30
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Ulaanbaatar.rb +0 -65
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Urumqi.rb +0 -33
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Vladivostok.rb +0 -164
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Yakutsk.rb +0 -163
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Yekaterinburg.rb +0 -165
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Yerevan.rb +0 -165
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Atlantic/Azores.rb +0 -270
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Atlantic/Cape_Verde.rb +0 -23
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Atlantic/South_Georgia.rb +0 -18
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Adelaide.rb +0 -187
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Brisbane.rb +0 -35
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Darwin.rb +0 -29
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Hobart.rb +0 -193
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Melbourne.rb +0 -185
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Perth.rb +0 -37
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Sydney.rb +0 -185
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Etc/UTC.rb +0 -16
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Amsterdam.rb +0 -228
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Athens.rb +0 -185
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Belgrade.rb +0 -163
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Berlin.rb +0 -188
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Bratislava.rb +0 -13
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Brussels.rb +0 -232
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Bucharest.rb +0 -181
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Budapest.rb +0 -197
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Copenhagen.rb +0 -179
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Dublin.rb +0 -276
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Helsinki.rb +0 -163
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Istanbul.rb +0 -218
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Kiev.rb +0 -168
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Lisbon.rb +0 -268
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Ljubljana.rb +0 -13
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/London.rb +0 -288
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Madrid.rb +0 -211
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Minsk.rb +0 -170
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Moscow.rb +0 -181
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Paris.rb +0 -232
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Prague.rb +0 -187
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Riga.rb +0 -176
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Rome.rb +0 -215
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Sarajevo.rb +0 -13
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Skopje.rb +0 -13
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Sofia.rb +0 -173
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Stockholm.rb +0 -165
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Tallinn.rb +0 -172
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Vienna.rb +0 -183
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Vilnius.rb +0 -170
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Warsaw.rb +0 -212
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Zagreb.rb +0 -13
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Auckland.rb +0 -202
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Fiji.rb +0 -23
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Guam.rb +0 -22
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Honolulu.rb +0 -28
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Majuro.rb +0 -20
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Midway.rb +0 -25
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Noumea.rb +0 -25
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Pago_Pago.rb +0 -26
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Port_Moresby.rb +0 -20
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Tongatapu.rb +0 -27
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/info_timezone.rb +0 -52
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/linked_timezone.rb +0 -51
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/linked_timezone_info.rb +0 -44
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/offset_rationals.rb +0 -98
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/ruby_core_support.rb +0 -56
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/time_or_datetime.rb +0 -292
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone.rb +0 -508
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_definition.rb +0 -56
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_info.rb +0 -40
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_offset_info.rb +0 -94
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_period.rb +0 -198
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_transition_info.rb +0 -129
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo.rb +0 -33
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/xml-simple-1.0.11/xmlsimple.rb +0 -1021
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor.rb +0 -34
- data/lib/gems/activesupport-2.2.2/lib/active_support/version.rb +0 -9
- data/lib/gems/activesupport-2.2.2/lib/active_support/whiny_nil.rb +0 -58
- data/lib/gems/activesupport-2.2.2/lib/active_support.rb +0 -61
- data/lib/gems/activesupport-2.2.2/lib/activesupport.rb +0 -1
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
# This class has dubious semantics and we only have it so that
|
|
2
|
-
# people can write params[:key] instead of params['key']
|
|
3
|
-
# and they get the same value for both keys.
|
|
4
|
-
|
|
5
|
-
class HashWithIndifferentAccess < Hash
|
|
6
|
-
def initialize(constructor = {})
|
|
7
|
-
if constructor.is_a?(Hash)
|
|
8
|
-
super()
|
|
9
|
-
update(constructor)
|
|
10
|
-
else
|
|
11
|
-
super(constructor)
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
def default(key = nil)
|
|
16
|
-
if key.is_a?(Symbol) && include?(key = key.to_s)
|
|
17
|
-
self[key]
|
|
18
|
-
else
|
|
19
|
-
super
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
alias_method :regular_writer, :[]= unless method_defined?(:regular_writer)
|
|
24
|
-
alias_method :regular_update, :update unless method_defined?(:regular_update)
|
|
25
|
-
|
|
26
|
-
# Assigns a new value to the hash:
|
|
27
|
-
#
|
|
28
|
-
# hash = HashWithIndifferentAccess.new
|
|
29
|
-
# hash[:key] = "value"
|
|
30
|
-
#
|
|
31
|
-
def []=(key, value)
|
|
32
|
-
regular_writer(convert_key(key), convert_value(value))
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
# Updates the instantized hash with values from the second:
|
|
36
|
-
#
|
|
37
|
-
# hash_1 = HashWithIndifferentAccess.new
|
|
38
|
-
# hash_1[:key] = "value"
|
|
39
|
-
#
|
|
40
|
-
# hash_2 = HashWithIndifferentAccess.new
|
|
41
|
-
# hash_2[:key] = "New Value!"
|
|
42
|
-
#
|
|
43
|
-
# hash_1.update(hash_2) # => {"key"=>"New Value!"}
|
|
44
|
-
#
|
|
45
|
-
def update(other_hash)
|
|
46
|
-
other_hash.each_pair { |key, value| regular_writer(convert_key(key), convert_value(value)) }
|
|
47
|
-
self
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
alias_method :merge!, :update
|
|
51
|
-
|
|
52
|
-
# Checks the hash for a key matching the argument passed in:
|
|
53
|
-
#
|
|
54
|
-
# hash = HashWithIndifferentAccess.new
|
|
55
|
-
# hash["key"] = "value"
|
|
56
|
-
# hash.key? :key # => true
|
|
57
|
-
# hash.key? "key" # => true
|
|
58
|
-
#
|
|
59
|
-
def key?(key)
|
|
60
|
-
super(convert_key(key))
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
alias_method :include?, :key?
|
|
64
|
-
alias_method :has_key?, :key?
|
|
65
|
-
alias_method :member?, :key?
|
|
66
|
-
|
|
67
|
-
# Fetches the value for the specified key, same as doing hash[key]
|
|
68
|
-
def fetch(key, *extras)
|
|
69
|
-
super(convert_key(key), *extras)
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
# Returns an array of the values at the specified indices:
|
|
73
|
-
#
|
|
74
|
-
# hash = HashWithIndifferentAccess.new
|
|
75
|
-
# hash[:a] = "x"
|
|
76
|
-
# hash[:b] = "y"
|
|
77
|
-
# hash.values_at("a", "b") # => ["x", "y"]
|
|
78
|
-
#
|
|
79
|
-
def values_at(*indices)
|
|
80
|
-
indices.collect {|key| self[convert_key(key)]}
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
# Returns an exact copy of the hash.
|
|
84
|
-
def dup
|
|
85
|
-
HashWithIndifferentAccess.new(self)
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
# Merges the instantized and the specified hashes together, giving precedence to the values from the second hash
|
|
89
|
-
# Does not overwrite the existing hash.
|
|
90
|
-
def merge(hash)
|
|
91
|
-
self.dup.update(hash)
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
# Removes a specified key from the hash.
|
|
95
|
-
def delete(key)
|
|
96
|
-
super(convert_key(key))
|
|
97
|
-
end
|
|
98
|
-
|
|
99
|
-
def stringify_keys!; self end
|
|
100
|
-
def symbolize_keys!; self end
|
|
101
|
-
def to_options!; self end
|
|
102
|
-
|
|
103
|
-
# Convert to a Hash with String keys.
|
|
104
|
-
def to_hash
|
|
105
|
-
Hash.new(default).merge(self)
|
|
106
|
-
end
|
|
107
|
-
|
|
108
|
-
protected
|
|
109
|
-
def convert_key(key)
|
|
110
|
-
key.kind_of?(Symbol) ? key.to_s : key
|
|
111
|
-
end
|
|
112
|
-
|
|
113
|
-
def convert_value(value)
|
|
114
|
-
case value
|
|
115
|
-
when Hash
|
|
116
|
-
value.with_indifferent_access
|
|
117
|
-
when Array
|
|
118
|
-
value.collect { |e| e.is_a?(Hash) ? e.with_indifferent_access : e }
|
|
119
|
-
else
|
|
120
|
-
value
|
|
121
|
-
end
|
|
122
|
-
end
|
|
123
|
-
end
|
|
124
|
-
|
|
125
|
-
module ActiveSupport #:nodoc:
|
|
126
|
-
module CoreExtensions #:nodoc:
|
|
127
|
-
module Hash #:nodoc:
|
|
128
|
-
module IndifferentAccess #:nodoc:
|
|
129
|
-
def with_indifferent_access
|
|
130
|
-
hash = HashWithIndifferentAccess.new(self)
|
|
131
|
-
hash.default = self.default
|
|
132
|
-
hash
|
|
133
|
-
end
|
|
134
|
-
end
|
|
135
|
-
end
|
|
136
|
-
end
|
|
137
|
-
end
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
module ActiveSupport #:nodoc:
|
|
2
|
-
module CoreExtensions #:nodoc:
|
|
3
|
-
module Hash #:nodoc:
|
|
4
|
-
module Keys
|
|
5
|
-
# Return a new hash with all keys converted to strings.
|
|
6
|
-
def stringify_keys
|
|
7
|
-
inject({}) do |options, (key, value)|
|
|
8
|
-
options[key.to_s] = value
|
|
9
|
-
options
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
# Destructively convert all keys to strings.
|
|
14
|
-
def stringify_keys!
|
|
15
|
-
keys.each do |key|
|
|
16
|
-
self[key.to_s] = delete(key)
|
|
17
|
-
end
|
|
18
|
-
self
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
# Return a new hash with all keys converted to symbols.
|
|
22
|
-
def symbolize_keys
|
|
23
|
-
inject({}) do |options, (key, value)|
|
|
24
|
-
options[(key.to_sym rescue key) || key] = value
|
|
25
|
-
options
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
# Destructively convert all keys to symbols.
|
|
30
|
-
def symbolize_keys!
|
|
31
|
-
self.replace(self.symbolize_keys)
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
alias_method :to_options, :symbolize_keys
|
|
35
|
-
alias_method :to_options!, :symbolize_keys!
|
|
36
|
-
|
|
37
|
-
# Validate all keys in a hash match *valid keys, raising ArgumentError on a mismatch.
|
|
38
|
-
# Note that keys are NOT treated indifferently, meaning if you use strings for keys but assert symbols
|
|
39
|
-
# as keys, this will fail.
|
|
40
|
-
#
|
|
41
|
-
# ==== Examples:
|
|
42
|
-
# { :name => "Rob", :years => "28" }.assert_valid_keys(:name, :age) # => raises "ArgumentError: Unknown key(s): years"
|
|
43
|
-
# { :name => "Rob", :age => "28" }.assert_valid_keys("name", "age") # => raises "ArgumentError: Unknown key(s): name, age"
|
|
44
|
-
# { :name => "Rob", :age => "28" }.assert_valid_keys(:name, :age) # => passes, raises nothing
|
|
45
|
-
def assert_valid_keys(*valid_keys)
|
|
46
|
-
unknown_keys = keys - [valid_keys].flatten
|
|
47
|
-
raise(ArgumentError, "Unknown key(s): #{unknown_keys.join(", ")}") unless unknown_keys.empty?
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
end
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
module ActiveSupport #:nodoc:
|
|
2
|
-
module CoreExtensions #:nodoc:
|
|
3
|
-
module Hash #:nodoc:
|
|
4
|
-
# Allows for reverse merging two hashes where the keys in the calling hash take precedence over those
|
|
5
|
-
# in the <tt>other_hash</tt>. This is particularly useful for initializing an option hash with default values:
|
|
6
|
-
#
|
|
7
|
-
# def setup(options = {})
|
|
8
|
-
# options.reverse_merge! :size => 25, :velocity => 10
|
|
9
|
-
# end
|
|
10
|
-
#
|
|
11
|
-
# Using <tt>merge</tt>, the above example would look as follows:
|
|
12
|
-
#
|
|
13
|
-
# def setup(options = {})
|
|
14
|
-
# { :size => 25, :velocity => 10 }.merge(options)
|
|
15
|
-
# end
|
|
16
|
-
#
|
|
17
|
-
# The default <tt>:size</tt> and <tt>:velocity</tt> are only set if the +options+ hash passed in doesn't already
|
|
18
|
-
# have the respective key.
|
|
19
|
-
module ReverseMerge
|
|
20
|
-
# Performs the opposite of <tt>merge</tt>, with the keys and values from the first hash taking precedence over the second.
|
|
21
|
-
def reverse_merge(other_hash)
|
|
22
|
-
other_hash.merge(self)
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
# Performs the opposite of <tt>merge</tt>, with the keys and values from the first hash taking precedence over the second.
|
|
26
|
-
# Modifies the receiver in place.
|
|
27
|
-
def reverse_merge!(other_hash)
|
|
28
|
-
replace(reverse_merge(other_hash))
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
alias_method :reverse_update, :reverse_merge!
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
end
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
module ActiveSupport #:nodoc:
|
|
2
|
-
module CoreExtensions #:nodoc:
|
|
3
|
-
module Hash #:nodoc:
|
|
4
|
-
# Slice a hash to include only the given keys. This is useful for
|
|
5
|
-
# limiting an options hash to valid keys before passing to a method:
|
|
6
|
-
#
|
|
7
|
-
# def search(criteria = {})
|
|
8
|
-
# assert_valid_keys(:mass, :velocity, :time)
|
|
9
|
-
# end
|
|
10
|
-
#
|
|
11
|
-
# search(options.slice(:mass, :velocity, :time))
|
|
12
|
-
#
|
|
13
|
-
# If you have an array of keys you want to limit to, you should splat them:
|
|
14
|
-
#
|
|
15
|
-
# valid_keys = [:mass, :velocity, :time]
|
|
16
|
-
# search(options.slice(*valid_keys))
|
|
17
|
-
module Slice
|
|
18
|
-
# Returns a new hash with only the given keys.
|
|
19
|
-
def slice(*keys)
|
|
20
|
-
keys = keys.map! { |key| convert_key(key) } if respond_to?(:convert_key)
|
|
21
|
-
hash = self.class.new
|
|
22
|
-
keys.each { |k| hash[k] = self[k] if has_key?(k) }
|
|
23
|
-
hash
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
# Replaces the hash with only the given keys.
|
|
27
|
-
def slice!(*keys)
|
|
28
|
-
replace(slice(*keys))
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
end
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
%w(keys indifferent_access deep_merge reverse_merge conversions diff slice except).each do |ext|
|
|
2
|
-
require "active_support/core_ext/hash/#{ext}"
|
|
3
|
-
end
|
|
4
|
-
|
|
5
|
-
class Hash #:nodoc:
|
|
6
|
-
include ActiveSupport::CoreExtensions::Hash::Keys
|
|
7
|
-
include ActiveSupport::CoreExtensions::Hash::IndifferentAccess
|
|
8
|
-
include ActiveSupport::CoreExtensions::Hash::DeepMerge
|
|
9
|
-
include ActiveSupport::CoreExtensions::Hash::ReverseMerge
|
|
10
|
-
include ActiveSupport::CoreExtensions::Hash::Conversions
|
|
11
|
-
include ActiveSupport::CoreExtensions::Hash::Diff
|
|
12
|
-
include ActiveSupport::CoreExtensions::Hash::Slice
|
|
13
|
-
include ActiveSupport::CoreExtensions::Hash::Except
|
|
14
|
-
end
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
module ActiveSupport #:nodoc:
|
|
2
|
-
module CoreExtensions #:nodoc:
|
|
3
|
-
module Integer #:nodoc:
|
|
4
|
-
# For checking if a fixnum is even or odd.
|
|
5
|
-
#
|
|
6
|
-
# 2.even? # => true
|
|
7
|
-
# 2.odd? # => false
|
|
8
|
-
# 1.even? # => false
|
|
9
|
-
# 1.odd? # => true
|
|
10
|
-
# 0.even? # => true
|
|
11
|
-
# 0.odd? # => false
|
|
12
|
-
# -1.even? # => false
|
|
13
|
-
# -1.odd? # => true
|
|
14
|
-
module EvenOdd
|
|
15
|
-
def multiple_of?(number)
|
|
16
|
-
self % number == 0
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def even?
|
|
20
|
-
multiple_of? 2
|
|
21
|
-
end if RUBY_VERSION < '1.9'
|
|
22
|
-
|
|
23
|
-
def odd?
|
|
24
|
-
!even?
|
|
25
|
-
end if RUBY_VERSION < '1.9'
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
end
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
require 'active_support/inflector'
|
|
2
|
-
|
|
3
|
-
module ActiveSupport #:nodoc:
|
|
4
|
-
module CoreExtensions #:nodoc:
|
|
5
|
-
module Integer #:nodoc:
|
|
6
|
-
module Inflections
|
|
7
|
-
# Ordinalize turns a number into an ordinal string used to denote the
|
|
8
|
-
# position in an ordered sequence such as 1st, 2nd, 3rd, 4th.
|
|
9
|
-
#
|
|
10
|
-
# 1.ordinalize # => "1st"
|
|
11
|
-
# 2.ordinalize # => "2nd"
|
|
12
|
-
# 1002.ordinalize # => "1002nd"
|
|
13
|
-
# 1003.ordinalize # => "1003rd"
|
|
14
|
-
def ordinalize
|
|
15
|
-
Inflector.ordinalize(self)
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
end
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
module ActiveSupport #:nodoc:
|
|
2
|
-
module CoreExtensions #:nodoc:
|
|
3
|
-
module Integer #:nodoc:
|
|
4
|
-
# Enables the use of time calculations and declarations, like 45.minutes + 2.hours + 4.years.
|
|
5
|
-
#
|
|
6
|
-
# These methods use Time#advance for precise date calculations when using from_now, ago, etc.
|
|
7
|
-
# as well as adding or subtracting their results from a Time object. For example:
|
|
8
|
-
#
|
|
9
|
-
# # equivalent to Time.now.advance(:months => 1)
|
|
10
|
-
# 1.month.from_now
|
|
11
|
-
#
|
|
12
|
-
# # equivalent to Time.now.advance(:years => 2)
|
|
13
|
-
# 2.years.from_now
|
|
14
|
-
#
|
|
15
|
-
# # equivalent to Time.now.advance(:months => 4, :years => 5)
|
|
16
|
-
# (4.months + 5.years).from_now
|
|
17
|
-
#
|
|
18
|
-
# While these methods provide precise calculation when used as in the examples above, care
|
|
19
|
-
# should be taken to note that this is not true if the result of `months', `years', etc is
|
|
20
|
-
# converted before use:
|
|
21
|
-
#
|
|
22
|
-
# # equivalent to 30.days.to_i.from_now
|
|
23
|
-
# 1.month.to_i.from_now
|
|
24
|
-
#
|
|
25
|
-
# # equivalent to 365.25.days.to_f.from_now
|
|
26
|
-
# 1.year.to_f.from_now
|
|
27
|
-
#
|
|
28
|
-
# In such cases, Ruby's core
|
|
29
|
-
# Date[http://stdlib.rubyonrails.org/libdoc/date/rdoc/index.html] and
|
|
30
|
-
# Time[http://stdlib.rubyonrails.org/libdoc/time/rdoc/index.html] should be used for precision
|
|
31
|
-
# date and time arithmetic
|
|
32
|
-
module Time
|
|
33
|
-
def months
|
|
34
|
-
ActiveSupport::Duration.new(self * 30.days, [[:months, self]])
|
|
35
|
-
end
|
|
36
|
-
alias :month :months
|
|
37
|
-
|
|
38
|
-
def years
|
|
39
|
-
ActiveSupport::Duration.new(self * 365.25.days, [[:years, self]])
|
|
40
|
-
end
|
|
41
|
-
alias :year :years
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
end
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
require 'active_support/core_ext/integer/even_odd'
|
|
2
|
-
require 'active_support/core_ext/integer/inflections'
|
|
3
|
-
require 'active_support/core_ext/integer/time'
|
|
4
|
-
|
|
5
|
-
class Integer #:nodoc:
|
|
6
|
-
include ActiveSupport::CoreExtensions::Integer::EvenOdd
|
|
7
|
-
include ActiveSupport::CoreExtensions::Integer::Inflections
|
|
8
|
-
include ActiveSupport::CoreExtensions::Integer::Time
|
|
9
|
-
end
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
class Object
|
|
2
|
-
# Makes backticks behave (somewhat more) similarly on all platforms.
|
|
3
|
-
# On win32 `nonexistent_command` raises Errno::ENOENT; on Unix, the
|
|
4
|
-
# spawned shell prints a message to stderr and sets $?. We emulate
|
|
5
|
-
# Unix on the former but not the latter.
|
|
6
|
-
def `(command) #:nodoc:
|
|
7
|
-
super
|
|
8
|
-
rescue Errno::ENOENT => e
|
|
9
|
-
STDERR.puts "#$0: #{e}"
|
|
10
|
-
end
|
|
11
|
-
end
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
module Kernel
|
|
2
|
-
unless respond_to?(:debugger)
|
|
3
|
-
# Starts a debugging session if ruby-debug has been loaded (call script/server --debugger to do load it).
|
|
4
|
-
def debugger
|
|
5
|
-
Rails.logger.info "\n***** Debugger requested, but was not available: Start server with --debugger to enable *****\n"
|
|
6
|
-
end
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
def breakpoint
|
|
10
|
-
Rails.logger.info "\n***** The 'breakpoint' command has been renamed 'debugger' -- please change *****\n"
|
|
11
|
-
debugger
|
|
12
|
-
end
|
|
13
|
-
end
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
module Kernel
|
|
2
|
-
# Sets $VERBOSE to nil for the duration of the block and back to its original value afterwards.
|
|
3
|
-
#
|
|
4
|
-
# silence_warnings do
|
|
5
|
-
# value = noisy_call # no warning voiced
|
|
6
|
-
# end
|
|
7
|
-
#
|
|
8
|
-
# noisy_call # warning voiced
|
|
9
|
-
def silence_warnings
|
|
10
|
-
old_verbose, $VERBOSE = $VERBOSE, nil
|
|
11
|
-
yield
|
|
12
|
-
ensure
|
|
13
|
-
$VERBOSE = old_verbose
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
# Sets $VERBOSE to true for the duration of the block and back to its original value afterwards.
|
|
17
|
-
def enable_warnings
|
|
18
|
-
old_verbose, $VERBOSE = $VERBOSE, true
|
|
19
|
-
yield
|
|
20
|
-
ensure
|
|
21
|
-
$VERBOSE = old_verbose
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
# For compatibility
|
|
25
|
-
def silence_stderr #:nodoc:
|
|
26
|
-
silence_stream(STDERR) { yield }
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
# Silences any stream for the duration of the block.
|
|
30
|
-
#
|
|
31
|
-
# silence_stream(STDOUT) do
|
|
32
|
-
# puts 'This will never be seen'
|
|
33
|
-
# end
|
|
34
|
-
#
|
|
35
|
-
# puts 'But this will'
|
|
36
|
-
def silence_stream(stream)
|
|
37
|
-
old_stream = stream.dup
|
|
38
|
-
stream.reopen(RUBY_PLATFORM =~ /mswin/ ? 'NUL:' : '/dev/null')
|
|
39
|
-
stream.sync = true
|
|
40
|
-
yield
|
|
41
|
-
ensure
|
|
42
|
-
stream.reopen(old_stream)
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
# Blocks and ignores any exception passed as argument if raised within the block.
|
|
46
|
-
#
|
|
47
|
-
# suppress(ZeroDivisionError) do
|
|
48
|
-
# 1/0
|
|
49
|
-
# puts "This code is NOT reached"
|
|
50
|
-
# end
|
|
51
|
-
#
|
|
52
|
-
# puts "This code gets executed and nothing related to ZeroDivisionError was seen"
|
|
53
|
-
def suppress(*exception_classes)
|
|
54
|
-
begin yield
|
|
55
|
-
rescue Exception => e
|
|
56
|
-
raise unless exception_classes.any? { |cls| e.kind_of?(cls) }
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
end
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
module Kernel
|
|
2
|
-
# Require a library with fallback to RubyGems. Warnings during library
|
|
3
|
-
# loading are silenced to increase signal/noise for application warnings.
|
|
4
|
-
def require_library_or_gem(library_name)
|
|
5
|
-
silence_warnings do
|
|
6
|
-
begin
|
|
7
|
-
require library_name
|
|
8
|
-
rescue LoadError => cannot_require
|
|
9
|
-
# 1. Requiring the module is unsuccessful, maybe it's a gem and nobody required rubygems yet. Try.
|
|
10
|
-
begin
|
|
11
|
-
require 'rubygems'
|
|
12
|
-
rescue LoadError => rubygems_not_installed
|
|
13
|
-
raise cannot_require
|
|
14
|
-
end
|
|
15
|
-
# 2. Rubygems is installed and loaded. Try to load the library again
|
|
16
|
-
begin
|
|
17
|
-
require library_name
|
|
18
|
-
rescue LoadError => gem_not_installed
|
|
19
|
-
raise cannot_require
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
end
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
class MissingSourceFile < LoadError #:nodoc:
|
|
2
|
-
attr_reader :path
|
|
3
|
-
def initialize(message, path)
|
|
4
|
-
super(message)
|
|
5
|
-
@path = path
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
def is_missing?(path)
|
|
9
|
-
path.gsub(/\.rb$/, '') == self.path.gsub(/\.rb$/, '')
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
def self.from_message(message)
|
|
13
|
-
REGEXPS.each do |regexp, capture|
|
|
14
|
-
match = regexp.match(message)
|
|
15
|
-
return MissingSourceFile.new(message, match[capture]) unless match.nil?
|
|
16
|
-
end
|
|
17
|
-
nil
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
REGEXPS = [
|
|
21
|
-
[/^no such file to load -- (.+)$/i, 1],
|
|
22
|
-
[/^Missing \w+ (file\s*)?([^\s]+.rb)$/i, 2],
|
|
23
|
-
[/^Missing API definition file in (.+)$/i, 1]
|
|
24
|
-
] unless defined?(REGEXPS)
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
module ActiveSupport #:nodoc:
|
|
28
|
-
module CoreExtensions #:nodoc:
|
|
29
|
-
module LoadErrorExtensions #:nodoc:
|
|
30
|
-
module LoadErrorClassMethods #:nodoc:
|
|
31
|
-
def new(*args)
|
|
32
|
-
(self == LoadError && MissingSourceFile.from_message(args.first)) || super
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
::LoadError.extend(LoadErrorClassMethods)
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
end
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
# Adds the 'around_level' method to Logger.
|
|
2
|
-
|
|
3
|
-
class Logger
|
|
4
|
-
def self.define_around_helper(level)
|
|
5
|
-
module_eval <<-end_eval
|
|
6
|
-
def around_#{level}(before_message, after_message, &block)
|
|
7
|
-
self.#{level}(before_message)
|
|
8
|
-
return_value = block.call(self)
|
|
9
|
-
self.#{level}(after_message)
|
|
10
|
-
return return_value
|
|
11
|
-
end
|
|
12
|
-
end_eval
|
|
13
|
-
end
|
|
14
|
-
[:debug, :info, :error, :fatal].each {|level| define_around_helper(level) }
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
require 'logger'
|
|
19
|
-
|
|
20
|
-
# Extensions to the built in Ruby logger.
|
|
21
|
-
#
|
|
22
|
-
# If you want to use the default log formatter as defined in the Ruby core, then you
|
|
23
|
-
# will need to set the formatter for the logger as in:
|
|
24
|
-
#
|
|
25
|
-
# logger.formatter = Formatter.new
|
|
26
|
-
#
|
|
27
|
-
# You can then specify the datetime format, for example:
|
|
28
|
-
#
|
|
29
|
-
# logger.datetime_format = "%Y-%m-%d"
|
|
30
|
-
#
|
|
31
|
-
# Note: This logger is deprecated in favor of ActiveSupport::BufferedLogger
|
|
32
|
-
class Logger
|
|
33
|
-
# Set to false to disable the silencer
|
|
34
|
-
cattr_accessor :silencer
|
|
35
|
-
self.silencer = true
|
|
36
|
-
|
|
37
|
-
# Silences the logger for the duration of the block.
|
|
38
|
-
def silence(temporary_level = Logger::ERROR)
|
|
39
|
-
if silencer
|
|
40
|
-
begin
|
|
41
|
-
old_logger_level, self.level = level, temporary_level
|
|
42
|
-
yield self
|
|
43
|
-
ensure
|
|
44
|
-
self.level = old_logger_level
|
|
45
|
-
end
|
|
46
|
-
else
|
|
47
|
-
yield self
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
alias :old_datetime_format= :datetime_format=
|
|
52
|
-
# Logging date-time format (string passed to +strftime+). Ignored if the formatter
|
|
53
|
-
# does not respond to datetime_format=.
|
|
54
|
-
def datetime_format=(datetime_format)
|
|
55
|
-
formatter.datetime_format = datetime_format if formatter.respond_to?(:datetime_format=)
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
alias :old_datetime_format :datetime_format
|
|
59
|
-
# Get the logging datetime format. Returns nil if the formatter does not support
|
|
60
|
-
# datetime formatting.
|
|
61
|
-
def datetime_format
|
|
62
|
-
formatter.datetime_format if formatter.respond_to?(:datetime_format)
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
alias :old_formatter :formatter if method_defined?(:formatter)
|
|
66
|
-
# Get the current formatter. The default formatter is a SimpleFormatter which only
|
|
67
|
-
# displays the log message
|
|
68
|
-
def formatter
|
|
69
|
-
@formatter ||= SimpleFormatter.new
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
unless const_defined? :Formatter
|
|
73
|
-
class Formatter
|
|
74
|
-
Format = "%s, [%s#%d] %5s -- %s: %s\n"
|
|
75
|
-
|
|
76
|
-
attr_accessor :datetime_format
|
|
77
|
-
|
|
78
|
-
def initialize
|
|
79
|
-
@datetime_format = nil
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
def call(severity, time, progname, msg)
|
|
83
|
-
Format % [severity[0..0], format_datetime(time), $$, severity, progname,
|
|
84
|
-
msg2str(msg)]
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
private
|
|
88
|
-
def format_datetime(time)
|
|
89
|
-
if @datetime_format.nil?
|
|
90
|
-
time.strftime("%Y-%m-%dT%H:%M:%S.") << "%06d " % time.usec
|
|
91
|
-
else
|
|
92
|
-
time.strftime(@datetime_format)
|
|
93
|
-
end
|
|
94
|
-
end
|
|
95
|
-
|
|
96
|
-
def msg2str(msg)
|
|
97
|
-
case msg
|
|
98
|
-
when ::String
|
|
99
|
-
msg
|
|
100
|
-
when ::Exception
|
|
101
|
-
"#{ msg.message } (#{ msg.class })\n" <<
|
|
102
|
-
(msg.backtrace || []).join("\n")
|
|
103
|
-
else
|
|
104
|
-
msg.inspect
|
|
105
|
-
end
|
|
106
|
-
end
|
|
107
|
-
end
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
# Simple formatter which only displays the message.
|
|
111
|
-
class SimpleFormatter < Logger::Formatter
|
|
112
|
-
# This method is invoked when a log event occurs
|
|
113
|
-
def call(severity, timestamp, progname, msg)
|
|
114
|
-
"#{String === msg ? msg : msg.inspect}\n"
|
|
115
|
-
end
|
|
116
|
-
end
|
|
117
|
-
|
|
118
|
-
private
|
|
119
|
-
alias old_format_message format_message
|
|
120
|
-
|
|
121
|
-
# Ruby 1.8.3 transposed the msg and progname arguments to format_message.
|
|
122
|
-
# We can't test RUBY_VERSION because some distributions don't keep Ruby
|
|
123
|
-
# and its standard library in sync, leading to installations of Ruby 1.8.2
|
|
124
|
-
# with Logger from 1.8.3 and vice versa.
|
|
125
|
-
if method_defined?(:formatter=)
|
|
126
|
-
def format_message(severity, timestamp, progname, msg)
|
|
127
|
-
formatter.call(severity, timestamp, progname, msg)
|
|
128
|
-
end
|
|
129
|
-
else
|
|
130
|
-
def format_message(severity, timestamp, msg, progname)
|
|
131
|
-
formatter.call(severity, timestamp, progname, msg)
|
|
132
|
-
end
|
|
133
|
-
|
|
134
|
-
attr_writer :formatter
|
|
135
|
-
public :formatter=
|
|
136
|
-
|
|
137
|
-
alias old_format_datetime format_datetime
|
|
138
|
-
def format_datetime(datetime) datetime end
|
|
139
|
-
|
|
140
|
-
alias old_msg2str msg2str
|
|
141
|
-
def msg2str(msg) msg end
|
|
142
|
-
end
|
|
143
|
-
end
|