mack-active_record 0.8.2 → 0.8.3
Sign up to get free protection for your applications and to get access to all the features.
- 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,167 +0,0 @@
|
|
1
|
-
require 'active_support/inflector'
|
2
|
-
|
3
|
-
module ActiveSupport #:nodoc:
|
4
|
-
module CoreExtensions #:nodoc:
|
5
|
-
module String #:nodoc:
|
6
|
-
# String inflections define new methods on the String class to transform names for different purposes.
|
7
|
-
# For instance, you can figure out the name of a database from the name of a class.
|
8
|
-
#
|
9
|
-
# "ScaleScore".tableize # => "scale_scores"
|
10
|
-
module Inflections
|
11
|
-
# Returns the plural form of the word in the string.
|
12
|
-
#
|
13
|
-
# "post".pluralize # => "posts"
|
14
|
-
# "octopus".pluralize # => "octopi"
|
15
|
-
# "sheep".pluralize # => "sheep"
|
16
|
-
# "words".pluralize # => "words"
|
17
|
-
# "the blue mailman".pluralize # => "the blue mailmen"
|
18
|
-
# "CamelOctopus".pluralize # => "CamelOctopi"
|
19
|
-
def pluralize
|
20
|
-
Inflector.pluralize(self)
|
21
|
-
end
|
22
|
-
|
23
|
-
# The reverse of +pluralize+, returns the singular form of a word in a string.
|
24
|
-
#
|
25
|
-
# "posts".singularize # => "post"
|
26
|
-
# "octopi".singularize # => "octopus"
|
27
|
-
# "sheep".singularize # => "sheep"
|
28
|
-
# "word".singularize # => "word"
|
29
|
-
# "the blue mailmen".singularize # => "the blue mailman"
|
30
|
-
# "CamelOctopi".singularize # => "CamelOctopus"
|
31
|
-
def singularize
|
32
|
-
Inflector.singularize(self)
|
33
|
-
end
|
34
|
-
|
35
|
-
# By default, +camelize+ converts strings to UpperCamelCase. If the argument to camelize
|
36
|
-
# is set to <tt>:lower</tt> then camelize produces lowerCamelCase.
|
37
|
-
#
|
38
|
-
# +camelize+ will also convert '/' to '::' which is useful for converting paths to namespaces.
|
39
|
-
#
|
40
|
-
# "active_record".camelize # => "ActiveRecord"
|
41
|
-
# "active_record".camelize(:lower) # => "activeRecord"
|
42
|
-
# "active_record/errors".camelize # => "ActiveRecord::Errors"
|
43
|
-
# "active_record/errors".camelize(:lower) # => "activeRecord::Errors"
|
44
|
-
def camelize(first_letter = :upper)
|
45
|
-
case first_letter
|
46
|
-
when :upper then Inflector.camelize(self, true)
|
47
|
-
when :lower then Inflector.camelize(self, false)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
alias_method :camelcase, :camelize
|
51
|
-
|
52
|
-
# Capitalizes all the words and replaces some characters in the string to create
|
53
|
-
# a nicer looking title. +titleize+ is meant for creating pretty output. It is not
|
54
|
-
# used in the Rails internals.
|
55
|
-
#
|
56
|
-
# +titleize+ is also aliased as +titlecase+.
|
57
|
-
#
|
58
|
-
# "man from the boondocks".titleize # => "Man From The Boondocks"
|
59
|
-
# "x-men: the last stand".titleize # => "X Men: The Last Stand"
|
60
|
-
def titleize
|
61
|
-
Inflector.titleize(self)
|
62
|
-
end
|
63
|
-
alias_method :titlecase, :titleize
|
64
|
-
|
65
|
-
# The reverse of +camelize+. Makes an underscored, lowercase form from the expression in the string.
|
66
|
-
#
|
67
|
-
# +underscore+ will also change '::' to '/' to convert namespaces to paths.
|
68
|
-
#
|
69
|
-
# "ActiveRecord".underscore # => "active_record"
|
70
|
-
# "ActiveRecord::Errors".underscore # => active_record/errors
|
71
|
-
def underscore
|
72
|
-
Inflector.underscore(self)
|
73
|
-
end
|
74
|
-
|
75
|
-
# Replaces underscores with dashes in the string.
|
76
|
-
#
|
77
|
-
# "puni_puni" # => "puni-puni"
|
78
|
-
def dasherize
|
79
|
-
Inflector.dasherize(self)
|
80
|
-
end
|
81
|
-
|
82
|
-
# Removes the module part from the constant expression in the string.
|
83
|
-
#
|
84
|
-
# "ActiveRecord::CoreExtensions::String::Inflections".demodulize # => "Inflections"
|
85
|
-
# "Inflections".demodulize # => "Inflections"
|
86
|
-
def demodulize
|
87
|
-
Inflector.demodulize(self)
|
88
|
-
end
|
89
|
-
|
90
|
-
# Replaces special characters in a string so that it may be used as part of a 'pretty' URL.
|
91
|
-
#
|
92
|
-
# ==== Examples
|
93
|
-
#
|
94
|
-
# class Person
|
95
|
-
# def to_param
|
96
|
-
# "#{id}-#{name.parameterize}"
|
97
|
-
# end
|
98
|
-
# end
|
99
|
-
#
|
100
|
-
# @person = Person.find(1)
|
101
|
-
# # => #<Person id: 1, name: "Donald E. Knuth">
|
102
|
-
#
|
103
|
-
# <%= link_to(@person.name, person_path %>
|
104
|
-
# # => <a href="/person/1-donald-e-knuth">Donald E. Knuth</a>
|
105
|
-
def parameterize
|
106
|
-
Inflector.parameterize(self)
|
107
|
-
end
|
108
|
-
|
109
|
-
# Creates the name of a table like Rails does for models to table names. This method
|
110
|
-
# uses the +pluralize+ method on the last word in the string.
|
111
|
-
#
|
112
|
-
# "RawScaledScorer".tableize # => "raw_scaled_scorers"
|
113
|
-
# "egg_and_ham".tableize # => "egg_and_hams"
|
114
|
-
# "fancyCategory".tableize # => "fancy_categories"
|
115
|
-
def tableize
|
116
|
-
Inflector.tableize(self)
|
117
|
-
end
|
118
|
-
|
119
|
-
# Create a class name from a plural table name like Rails does for table names to models.
|
120
|
-
# Note that this returns a string and not a class. (To convert to an actual class
|
121
|
-
# follow +classify+ with +constantize+.)
|
122
|
-
#
|
123
|
-
# "egg_and_hams".classify # => "EggAndHam"
|
124
|
-
# "posts".classify # => "Post"
|
125
|
-
#
|
126
|
-
# Singular names are not handled correctly.
|
127
|
-
#
|
128
|
-
# "business".classify # => "Busines"
|
129
|
-
def classify
|
130
|
-
Inflector.classify(self)
|
131
|
-
end
|
132
|
-
|
133
|
-
# Capitalizes the first word, turns underscores into spaces, and strips '_id'.
|
134
|
-
# Like +titleize+, this is meant for creating pretty output.
|
135
|
-
#
|
136
|
-
# "employee_salary" # => "Employee salary"
|
137
|
-
# "author_id" # => "Author"
|
138
|
-
def humanize
|
139
|
-
Inflector.humanize(self)
|
140
|
-
end
|
141
|
-
|
142
|
-
# Creates a foreign key name from a class name.
|
143
|
-
# +separate_class_name_and_id_with_underscore+ sets whether
|
144
|
-
# the method should put '_' between the name and 'id'.
|
145
|
-
#
|
146
|
-
# Examples
|
147
|
-
# "Message".foreign_key # => "message_id"
|
148
|
-
# "Message".foreign_key(false) # => "messageid"
|
149
|
-
# "Admin::Post".foreign_key # => "post_id"
|
150
|
-
def foreign_key(separate_class_name_and_id_with_underscore = true)
|
151
|
-
Inflector.foreign_key(self, separate_class_name_and_id_with_underscore)
|
152
|
-
end
|
153
|
-
|
154
|
-
# +constantize+ tries to find a declared constant with the name specified
|
155
|
-
# in the string. It raises a NameError when the name is not in CamelCase
|
156
|
-
# or is not initialized.
|
157
|
-
#
|
158
|
-
# Examples
|
159
|
-
# "Module".constantize # => Module
|
160
|
-
# "Class".constantize # => Class
|
161
|
-
def constantize
|
162
|
-
Inflector.constantize(self)
|
163
|
-
end
|
164
|
-
end
|
165
|
-
end
|
166
|
-
end
|
167
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
require 'strscan'
|
2
|
-
|
3
|
-
module ActiveSupport #:nodoc:
|
4
|
-
module CoreExtensions #:nodoc:
|
5
|
-
module String #:nodoc:
|
6
|
-
# Custom string iterators
|
7
|
-
module Iterators
|
8
|
-
def self.append_features(base)
|
9
|
-
super unless '1.9'.respond_to?(:each_char)
|
10
|
-
end
|
11
|
-
|
12
|
-
# Yields a single-character string for each character in the string.
|
13
|
-
# When $KCODE = 'UTF8', multi-byte characters are yielded appropriately.
|
14
|
-
def each_char
|
15
|
-
scanner, char = StringScanner.new(self), /./mu
|
16
|
-
loop { yield(scanner.scan(char) || break) }
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,81 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
module ActiveSupport #:nodoc:
|
4
|
-
module CoreExtensions #:nodoc:
|
5
|
-
module String #:nodoc:
|
6
|
-
# Implements multibyte methods for easier access to multibyte characters in a String instance.
|
7
|
-
module Multibyte
|
8
|
-
unless '1.9'.respond_to?(:force_encoding)
|
9
|
-
# == Multibyte proxy
|
10
|
-
#
|
11
|
-
# +mb_chars+ is a multibyte safe proxy for string methods.
|
12
|
-
#
|
13
|
-
# In Ruby 1.8 and older it creates and returns an instance of the ActiveSupport::Multibyte::Chars class which
|
14
|
-
# encapsulates the original string. A Unicode safe version of all the String methods are defined on this proxy
|
15
|
-
# class. If the proxy class doesn't respond to a certain method, it's forwarded to the encapsuled string.
|
16
|
-
#
|
17
|
-
# name = 'Claus Müller'
|
18
|
-
# name.reverse #=> "rell??M sualC"
|
19
|
-
# name.length #=> 13
|
20
|
-
#
|
21
|
-
# name.mb_chars.reverse.to_s #=> "rellüM sualC"
|
22
|
-
# name.mb_chars.length #=> 12
|
23
|
-
#
|
24
|
-
# In Ruby 1.9 and newer +mb_chars+ returns +self+ because String is (mostly) encoding aware. This means that
|
25
|
-
# it becomes easy to run one version of your code on multiple Ruby versions.
|
26
|
-
#
|
27
|
-
# == Method chaining
|
28
|
-
#
|
29
|
-
# All the methods on the Chars proxy which normally return a string will return a Chars object. This allows
|
30
|
-
# method chaining on the result of any of these methods.
|
31
|
-
#
|
32
|
-
# name.mb_chars.reverse.length #=> 12
|
33
|
-
#
|
34
|
-
# == Interoperability and configuration
|
35
|
-
#
|
36
|
-
# The Chars object tries to be as interchangeable with String objects as possible: sorting and comparing between
|
37
|
-
# String and Char work like expected. The bang! methods change the internal string representation in the Chars
|
38
|
-
# object. Interoperability problems can be resolved easily with a +to_s+ call.
|
39
|
-
#
|
40
|
-
# For more information about the methods defined on the Chars proxy see ActiveSupport::Multibyte::Chars. For
|
41
|
-
# information about how to change the default Multibyte behaviour see ActiveSupport::Multibyte.
|
42
|
-
def mb_chars
|
43
|
-
if ActiveSupport::Multibyte.proxy_class.wants?(self)
|
44
|
-
ActiveSupport::Multibyte.proxy_class.new(self)
|
45
|
-
else
|
46
|
-
self
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
# Returns true if the string has UTF-8 semantics (a String used for purely byte resources is unlikely to have
|
51
|
-
# them), returns false otherwise.
|
52
|
-
def is_utf8?
|
53
|
-
ActiveSupport::Multibyte::Chars.consumes?(self)
|
54
|
-
end
|
55
|
-
|
56
|
-
unless '1.8.7 and later'.respond_to?(:chars)
|
57
|
-
def chars
|
58
|
-
ActiveSupport::Deprecation.warn('String#chars has been deprecated in favor of String#mb_chars.', caller)
|
59
|
-
mb_chars
|
60
|
-
end
|
61
|
-
end
|
62
|
-
else
|
63
|
-
def mb_chars #:nodoc
|
64
|
-
self
|
65
|
-
end
|
66
|
-
|
67
|
-
def is_utf8? #:nodoc
|
68
|
-
case encoding
|
69
|
-
when Encoding::UTF_8
|
70
|
-
valid_encoding?
|
71
|
-
when Encoding::ASCII_8BIT, Encoding::US_ASCII
|
72
|
-
dup.force_encoding(Encoding::UTF_8).valid_encoding?
|
73
|
-
else
|
74
|
-
false
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
module ActiveSupport #:nodoc:
|
2
|
-
module CoreExtensions #:nodoc:
|
3
|
-
module String #:nodoc:
|
4
|
-
# Additional string tests.
|
5
|
-
module StartsEndsWith
|
6
|
-
def self.append_features(base)
|
7
|
-
if '1.8.7 and up'.respond_to?(:start_with?)
|
8
|
-
base.class_eval do
|
9
|
-
alias_method :starts_with?, :start_with?
|
10
|
-
alias_method :ends_with?, :end_with?
|
11
|
-
end
|
12
|
-
else
|
13
|
-
super
|
14
|
-
base.class_eval do
|
15
|
-
alias_method :start_with?, :starts_with?
|
16
|
-
alias_method :end_with?, :ends_with?
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
# Does the string start with the specified +prefix+?
|
22
|
-
def starts_with?(prefix)
|
23
|
-
prefix = prefix.to_s
|
24
|
-
self[0, prefix.length] == prefix
|
25
|
-
end
|
26
|
-
|
27
|
-
# Does the string end with the specified +suffix+?
|
28
|
-
def ends_with?(suffix)
|
29
|
-
suffix = suffix.to_s
|
30
|
-
self[-suffix.length, suffix.length] == suffix
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'active_support/core_ext/string/inflections'
|
4
|
-
require 'active_support/core_ext/string/conversions'
|
5
|
-
require 'active_support/core_ext/string/access'
|
6
|
-
require 'active_support/core_ext/string/starts_ends_with'
|
7
|
-
require 'active_support/core_ext/string/iterators'
|
8
|
-
require 'active_support/core_ext/string/multibyte'
|
9
|
-
require 'active_support/core_ext/string/xchar'
|
10
|
-
require 'active_support/core_ext/string/filters'
|
11
|
-
require 'active_support/core_ext/string/behavior'
|
12
|
-
|
13
|
-
class String #:nodoc:
|
14
|
-
include ActiveSupport::CoreExtensions::String::Access
|
15
|
-
include ActiveSupport::CoreExtensions::String::Conversions
|
16
|
-
include ActiveSupport::CoreExtensions::String::Filters
|
17
|
-
include ActiveSupport::CoreExtensions::String::Inflections
|
18
|
-
include ActiveSupport::CoreExtensions::String::StartsEndsWith
|
19
|
-
include ActiveSupport::CoreExtensions::String::Iterators
|
20
|
-
include ActiveSupport::CoreExtensions::String::Behavior
|
21
|
-
include ActiveSupport::CoreExtensions::String::Multibyte
|
22
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
unless :to_proc.respond_to?(:to_proc)
|
2
|
-
class Symbol
|
3
|
-
# Turns the symbol into a simple proc, which is especially useful for enumerations. Examples:
|
4
|
-
#
|
5
|
-
# # The same as people.collect { |p| p.name }
|
6
|
-
# people.collect(&:name)
|
7
|
-
#
|
8
|
-
# # The same as people.select { |p| p.manager? }.collect { |p| p.salary }
|
9
|
-
# people.select(&:manager?).collect(&:salary)
|
10
|
-
def to_proc
|
11
|
-
Proc.new { |*args| args.shift.__send__(self, *args) }
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
module ActiveSupport #:nodoc:
|
2
|
-
module CoreExtensions #:nodoc:
|
3
|
-
module Time #:nodoc:
|
4
|
-
module Behavior
|
5
|
-
# Enable more predictable duck-typing on Time-like classes. See
|
6
|
-
# Object#acts_like?.
|
7
|
-
def acts_like_time?
|
8
|
-
true
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
@@ -1,303 +0,0 @@
|
|
1
|
-
require 'active_support/duration'
|
2
|
-
|
3
|
-
module ActiveSupport #:nodoc:
|
4
|
-
module CoreExtensions #:nodoc:
|
5
|
-
module Time #:nodoc:
|
6
|
-
# Enables the use of time calculations within Time itself
|
7
|
-
module Calculations
|
8
|
-
def self.included(base) #:nodoc:
|
9
|
-
base.extend ClassMethods
|
10
|
-
|
11
|
-
base.class_eval do
|
12
|
-
alias_method :plus_without_duration, :+
|
13
|
-
alias_method :+, :plus_with_duration
|
14
|
-
|
15
|
-
alias_method :minus_without_duration, :-
|
16
|
-
alias_method :-, :minus_with_duration
|
17
|
-
|
18
|
-
alias_method :minus_without_coercion, :-
|
19
|
-
alias_method :-, :minus_with_coercion
|
20
|
-
|
21
|
-
alias_method :compare_without_coercion, :<=>
|
22
|
-
alias_method :<=>, :compare_with_coercion
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
COMMON_YEAR_DAYS_IN_MONTH = [nil, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
|
27
|
-
|
28
|
-
module ClassMethods
|
29
|
-
# Overriding case equality method so that it returns true for ActiveSupport::TimeWithZone instances
|
30
|
-
def ===(other)
|
31
|
-
other.is_a?(::Time)
|
32
|
-
end
|
33
|
-
|
34
|
-
# Return the number of days in the given month.
|
35
|
-
# If no year is specified, it will use the current year.
|
36
|
-
def days_in_month(month, year = now.year)
|
37
|
-
return 29 if month == 2 && ::Date.gregorian_leap?(year)
|
38
|
-
COMMON_YEAR_DAYS_IN_MONTH[month]
|
39
|
-
end
|
40
|
-
|
41
|
-
# Returns a new Time if requested year can be accommodated by Ruby's Time class
|
42
|
-
# (i.e., if year is within either 1970..2038 or 1902..2038, depending on system architecture);
|
43
|
-
# otherwise returns a DateTime
|
44
|
-
def time_with_datetime_fallback(utc_or_local, year, month=1, day=1, hour=0, min=0, sec=0, usec=0)
|
45
|
-
::Time.send(utc_or_local, year, month, day, hour, min, sec, usec)
|
46
|
-
rescue
|
47
|
-
offset = utc_or_local.to_sym == :local ? ::DateTime.local_offset : 0
|
48
|
-
::DateTime.civil(year, month, day, hour, min, sec, offset)
|
49
|
-
end
|
50
|
-
|
51
|
-
# Wraps class method +time_with_datetime_fallback+ with +utc_or_local+ set to <tt>:utc</tt>.
|
52
|
-
def utc_time(*args)
|
53
|
-
time_with_datetime_fallback(:utc, *args)
|
54
|
-
end
|
55
|
-
|
56
|
-
# Wraps class method +time_with_datetime_fallback+ with +utc_or_local+ set to <tt>:local</tt>.
|
57
|
-
def local_time(*args)
|
58
|
-
time_with_datetime_fallback(:local, *args)
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
# Tells whether the Time object's time lies in the past
|
63
|
-
def past?
|
64
|
-
self < ::Time.current
|
65
|
-
end
|
66
|
-
|
67
|
-
# Tells whether the Time object's time is today
|
68
|
-
def today?
|
69
|
-
self.to_date == ::Date.current
|
70
|
-
end
|
71
|
-
|
72
|
-
# Tells whether the Time object's time lies in the future
|
73
|
-
def future?
|
74
|
-
self > ::Time.current
|
75
|
-
end
|
76
|
-
|
77
|
-
# Seconds since midnight: Time.now.seconds_since_midnight
|
78
|
-
def seconds_since_midnight
|
79
|
-
self.to_i - self.change(:hour => 0).to_i + (self.usec/1.0e+6)
|
80
|
-
end
|
81
|
-
|
82
|
-
# Returns a new Time where one or more of the elements have been changed according to the +options+ parameter. The time options
|
83
|
-
# (hour, minute, sec, usec) reset cascadingly, so if only the hour is passed, then minute, sec, and usec is set to 0. If the hour and
|
84
|
-
# minute is passed, then sec and usec is set to 0.
|
85
|
-
def change(options)
|
86
|
-
::Time.send(
|
87
|
-
self.utc? ? :utc_time : :local_time,
|
88
|
-
options[:year] || self.year,
|
89
|
-
options[:month] || self.month,
|
90
|
-
options[:day] || self.day,
|
91
|
-
options[:hour] || self.hour,
|
92
|
-
options[:min] || (options[:hour] ? 0 : self.min),
|
93
|
-
options[:sec] || ((options[:hour] || options[:min]) ? 0 : self.sec),
|
94
|
-
options[:usec] || ((options[:hour] || options[:min] || options[:sec]) ? 0 : self.usec)
|
95
|
-
)
|
96
|
-
end
|
97
|
-
|
98
|
-
# Uses Date to provide precise Time calculations for years, months, and days.
|
99
|
-
# The +options+ parameter takes a hash with any of these keys: <tt>:years</tt>,
|
100
|
-
# <tt>:months</tt>, <tt>:weeks</tt>, <tt>:days</tt>, <tt>:hours</tt>,
|
101
|
-
# <tt>:minutes</tt>, <tt>:seconds</tt>.
|
102
|
-
def advance(options)
|
103
|
-
unless options[:weeks].nil?
|
104
|
-
options[:weeks], partial_weeks = options[:weeks].divmod(1)
|
105
|
-
options[:days] = (options[:days] || 0) + 7 * partial_weeks
|
106
|
-
end
|
107
|
-
|
108
|
-
unless options[:days].nil?
|
109
|
-
options[:days], partial_days = options[:days].divmod(1)
|
110
|
-
options[:hours] = (options[:hours] || 0) + 24 * partial_days
|
111
|
-
end
|
112
|
-
|
113
|
-
d = to_date.advance(options)
|
114
|
-
time_advanced_by_date = change(:year => d.year, :month => d.month, :day => d.day)
|
115
|
-
seconds_to_advance = (options[:seconds] || 0) + (options[:minutes] || 0) * 60 + (options[:hours] || 0) * 3600
|
116
|
-
seconds_to_advance == 0 ? time_advanced_by_date : time_advanced_by_date.since(seconds_to_advance)
|
117
|
-
end
|
118
|
-
|
119
|
-
# Returns a new Time representing the time a number of seconds ago, this is basically a wrapper around the Numeric extension
|
120
|
-
def ago(seconds)
|
121
|
-
self.since(-seconds)
|
122
|
-
end
|
123
|
-
|
124
|
-
# Returns a new Time representing the time a number of seconds since the instance time, this is basically a wrapper around
|
125
|
-
# the Numeric extension.
|
126
|
-
def since(seconds)
|
127
|
-
f = seconds.since(self)
|
128
|
-
if ActiveSupport::Duration === seconds
|
129
|
-
f
|
130
|
-
else
|
131
|
-
initial_dst = self.dst? ? 1 : 0
|
132
|
-
final_dst = f.dst? ? 1 : 0
|
133
|
-
(seconds.abs >= 86400 && initial_dst != final_dst) ? f + (initial_dst - final_dst).hours : f
|
134
|
-
end
|
135
|
-
rescue
|
136
|
-
self.to_datetime.since(seconds)
|
137
|
-
end
|
138
|
-
alias :in :since
|
139
|
-
|
140
|
-
# Returns a new Time representing the time a number of specified months ago
|
141
|
-
def months_ago(months)
|
142
|
-
advance(:months => -months)
|
143
|
-
end
|
144
|
-
|
145
|
-
# Returns a new Time representing the time a number of specified months in the future
|
146
|
-
def months_since(months)
|
147
|
-
advance(:months => months)
|
148
|
-
end
|
149
|
-
|
150
|
-
# Returns a new Time representing the time a number of specified years ago
|
151
|
-
def years_ago(years)
|
152
|
-
advance(:years => -years)
|
153
|
-
end
|
154
|
-
|
155
|
-
# Returns a new Time representing the time a number of specified years in the future
|
156
|
-
def years_since(years)
|
157
|
-
advance(:years => years)
|
158
|
-
end
|
159
|
-
|
160
|
-
# Short-hand for years_ago(1)
|
161
|
-
def last_year
|
162
|
-
years_ago(1)
|
163
|
-
end
|
164
|
-
|
165
|
-
# Short-hand for years_since(1)
|
166
|
-
def next_year
|
167
|
-
years_since(1)
|
168
|
-
end
|
169
|
-
|
170
|
-
|
171
|
-
# Short-hand for months_ago(1)
|
172
|
-
def last_month
|
173
|
-
months_ago(1)
|
174
|
-
end
|
175
|
-
|
176
|
-
# Short-hand for months_since(1)
|
177
|
-
def next_month
|
178
|
-
months_since(1)
|
179
|
-
end
|
180
|
-
|
181
|
-
# Returns a new Time representing the "start" of this week (Monday, 0:00)
|
182
|
-
def beginning_of_week
|
183
|
-
days_to_monday = self.wday!=0 ? self.wday-1 : 6
|
184
|
-
(self - days_to_monday.days).midnight
|
185
|
-
end
|
186
|
-
alias :monday :beginning_of_week
|
187
|
-
alias :at_beginning_of_week :beginning_of_week
|
188
|
-
|
189
|
-
# Returns a new Time representing the end of this week (Sunday, 23:59:59)
|
190
|
-
def end_of_week
|
191
|
-
days_to_sunday = self.wday!=0 ? 7-self.wday : 0
|
192
|
-
(self + days_to_sunday.days).end_of_day
|
193
|
-
end
|
194
|
-
alias :at_end_of_week :end_of_week
|
195
|
-
|
196
|
-
# Returns a new Time representing the start of the given day in next week (default is Monday).
|
197
|
-
def next_week(day = :monday)
|
198
|
-
days_into_week = { :monday => 0, :tuesday => 1, :wednesday => 2, :thursday => 3, :friday => 4, :saturday => 5, :sunday => 6}
|
199
|
-
since(1.week).beginning_of_week.since(days_into_week[day].day).change(:hour => 0)
|
200
|
-
end
|
201
|
-
|
202
|
-
# Returns a new Time representing the start of the day (0:00)
|
203
|
-
def beginning_of_day
|
204
|
-
(self - self.seconds_since_midnight).change(:usec => 0)
|
205
|
-
end
|
206
|
-
alias :midnight :beginning_of_day
|
207
|
-
alias :at_midnight :beginning_of_day
|
208
|
-
alias :at_beginning_of_day :beginning_of_day
|
209
|
-
|
210
|
-
# Returns a new Time representing the end of the day (23:59:59)
|
211
|
-
def end_of_day
|
212
|
-
change(:hour => 23, :min => 59, :sec => 59)
|
213
|
-
end
|
214
|
-
|
215
|
-
# Returns a new Time representing the start of the month (1st of the month, 0:00)
|
216
|
-
def beginning_of_month
|
217
|
-
#self - ((self.mday-1).days + self.seconds_since_midnight)
|
218
|
-
change(:day => 1,:hour => 0, :min => 0, :sec => 0, :usec => 0)
|
219
|
-
end
|
220
|
-
alias :at_beginning_of_month :beginning_of_month
|
221
|
-
|
222
|
-
# Returns a new Time representing the end of the month (last day of the month, 0:00)
|
223
|
-
def end_of_month
|
224
|
-
#self - ((self.mday-1).days + self.seconds_since_midnight)
|
225
|
-
last_day = ::Time.days_in_month( self.month, self.year )
|
226
|
-
change(:day => last_day, :hour => 23, :min => 59, :sec => 59, :usec => 0)
|
227
|
-
end
|
228
|
-
alias :at_end_of_month :end_of_month
|
229
|
-
|
230
|
-
# Returns a new Time representing the start of the quarter (1st of january, april, july, october, 0:00)
|
231
|
-
def beginning_of_quarter
|
232
|
-
beginning_of_month.change(:month => [10, 7, 4, 1].detect { |m| m <= self.month })
|
233
|
-
end
|
234
|
-
alias :at_beginning_of_quarter :beginning_of_quarter
|
235
|
-
|
236
|
-
# Returns a new Time representing the end of the quarter (last day of march, june, september, december, 23:59:59)
|
237
|
-
def end_of_quarter
|
238
|
-
beginning_of_month.change(:month => [3, 6, 9, 12].detect { |m| m >= self.month }).end_of_month
|
239
|
-
end
|
240
|
-
alias :at_end_of_quarter :end_of_quarter
|
241
|
-
|
242
|
-
# Returns a new Time representing the start of the year (1st of january, 0:00)
|
243
|
-
def beginning_of_year
|
244
|
-
change(:month => 1,:day => 1,:hour => 0, :min => 0, :sec => 0, :usec => 0)
|
245
|
-
end
|
246
|
-
alias :at_beginning_of_year :beginning_of_year
|
247
|
-
|
248
|
-
# Returns a new Time representing the end of the year (31st of december, 23:59:59)
|
249
|
-
def end_of_year
|
250
|
-
change(:month => 12,:day => 31,:hour => 23, :min => 59, :sec => 59)
|
251
|
-
end
|
252
|
-
alias :at_end_of_year :end_of_year
|
253
|
-
|
254
|
-
# Convenience method which returns a new Time representing the time 1 day ago
|
255
|
-
def yesterday
|
256
|
-
advance(:days => -1)
|
257
|
-
end
|
258
|
-
|
259
|
-
# Convenience method which returns a new Time representing the time 1 day since the instance time
|
260
|
-
def tomorrow
|
261
|
-
advance(:days => 1)
|
262
|
-
end
|
263
|
-
|
264
|
-
def plus_with_duration(other) #:nodoc:
|
265
|
-
if ActiveSupport::Duration === other
|
266
|
-
other.since(self)
|
267
|
-
else
|
268
|
-
plus_without_duration(other)
|
269
|
-
end
|
270
|
-
end
|
271
|
-
|
272
|
-
def minus_with_duration(other) #:nodoc:
|
273
|
-
if ActiveSupport::Duration === other
|
274
|
-
other.until(self)
|
275
|
-
else
|
276
|
-
minus_without_duration(other)
|
277
|
-
end
|
278
|
-
end
|
279
|
-
|
280
|
-
# Time#- can also be used to determine the number of seconds between two Time instances.
|
281
|
-
# We're layering on additional behavior so that ActiveSupport::TimeWithZone instances
|
282
|
-
# are coerced into values that Time#- will recognize
|
283
|
-
def minus_with_coercion(other)
|
284
|
-
other = other.comparable_time if other.respond_to?(:comparable_time)
|
285
|
-
minus_without_coercion(other)
|
286
|
-
end
|
287
|
-
|
288
|
-
# Layers additional behavior on Time#<=> so that DateTime and ActiveSupport::TimeWithZone instances
|
289
|
-
# can be chronologically compared with a Time
|
290
|
-
def compare_with_coercion(other)
|
291
|
-
# if other is an ActiveSupport::TimeWithZone, coerce a Time instance from it so we can do <=> comparison
|
292
|
-
other = other.comparable_time if other.respond_to?(:comparable_time)
|
293
|
-
if other.acts_like?(:date)
|
294
|
-
# other is a Date/DateTime, so coerce self #to_datetime and hand off to DateTime#<=>
|
295
|
-
to_datetime.compare_without_coercion(other)
|
296
|
-
else
|
297
|
-
compare_without_coercion(other)
|
298
|
-
end
|
299
|
-
end
|
300
|
-
end
|
301
|
-
end
|
302
|
-
end
|
303
|
-
end
|