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,74 +0,0 @@
|
|
|
1
|
-
module ActiveSupport
|
|
2
|
-
module CoreExtensions
|
|
3
|
-
module Module
|
|
4
|
-
# Encapsulates the common pattern of:
|
|
5
|
-
#
|
|
6
|
-
# alias_method :foo_without_feature, :foo
|
|
7
|
-
# alias_method :foo, :foo_with_feature
|
|
8
|
-
#
|
|
9
|
-
# With this, you simply do:
|
|
10
|
-
#
|
|
11
|
-
# alias_method_chain :foo, :feature
|
|
12
|
-
#
|
|
13
|
-
# And both aliases are set up for you.
|
|
14
|
-
#
|
|
15
|
-
# Query and bang methods (foo?, foo!) keep the same punctuation:
|
|
16
|
-
#
|
|
17
|
-
# alias_method_chain :foo?, :feature
|
|
18
|
-
#
|
|
19
|
-
# is equivalent to
|
|
20
|
-
#
|
|
21
|
-
# alias_method :foo_without_feature?, :foo?
|
|
22
|
-
# alias_method :foo?, :foo_with_feature?
|
|
23
|
-
#
|
|
24
|
-
# so you can safely chain foo, foo?, and foo! with the same feature.
|
|
25
|
-
def alias_method_chain(target, feature)
|
|
26
|
-
# Strip out punctuation on predicates or bang methods since
|
|
27
|
-
# e.g. target?_without_feature is not a valid method name.
|
|
28
|
-
aliased_target, punctuation = target.to_s.sub(/([?!=])$/, ''), $1
|
|
29
|
-
yield(aliased_target, punctuation) if block_given?
|
|
30
|
-
|
|
31
|
-
with_method, without_method = "#{aliased_target}_with_#{feature}#{punctuation}", "#{aliased_target}_without_#{feature}#{punctuation}"
|
|
32
|
-
|
|
33
|
-
alias_method without_method, target
|
|
34
|
-
alias_method target, with_method
|
|
35
|
-
|
|
36
|
-
case
|
|
37
|
-
when public_method_defined?(without_method)
|
|
38
|
-
public target
|
|
39
|
-
when protected_method_defined?(without_method)
|
|
40
|
-
protected target
|
|
41
|
-
when private_method_defined?(without_method)
|
|
42
|
-
private target
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
# Allows you to make aliases for attributes, which includes
|
|
47
|
-
# getter, setter, and query methods.
|
|
48
|
-
#
|
|
49
|
-
# Example:
|
|
50
|
-
#
|
|
51
|
-
# class Content < ActiveRecord::Base
|
|
52
|
-
# # has a title attribute
|
|
53
|
-
# end
|
|
54
|
-
#
|
|
55
|
-
# class Email < Content
|
|
56
|
-
# alias_attribute :subject, :title
|
|
57
|
-
# end
|
|
58
|
-
#
|
|
59
|
-
# e = Email.find(1)
|
|
60
|
-
# e.title # => "Superstars"
|
|
61
|
-
# e.subject # => "Superstars"
|
|
62
|
-
# e.subject? # => true
|
|
63
|
-
# e.subject = "Megastars"
|
|
64
|
-
# e.title # => "Megastars"
|
|
65
|
-
def alias_attribute(new_name, old_name)
|
|
66
|
-
module_eval <<-STR, __FILE__, __LINE__+1
|
|
67
|
-
def #{new_name}; self.#{old_name}; end
|
|
68
|
-
def #{new_name}?; self.#{old_name}?; end
|
|
69
|
-
def #{new_name}=(v); self.#{old_name} = v; end
|
|
70
|
-
STR
|
|
71
|
-
end
|
|
72
|
-
end
|
|
73
|
-
end
|
|
74
|
-
end
|
data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/module/attr_accessor_with_default.rb
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
class Module
|
|
2
|
-
# Declare an attribute accessor with an initial default return value.
|
|
3
|
-
#
|
|
4
|
-
# To give attribute <tt>:age</tt> the initial value <tt>25</tt>:
|
|
5
|
-
#
|
|
6
|
-
# class Person
|
|
7
|
-
# attr_accessor_with_default :age, 25
|
|
8
|
-
# end
|
|
9
|
-
#
|
|
10
|
-
# some_person.age
|
|
11
|
-
# => 25
|
|
12
|
-
# some_person.age = 26
|
|
13
|
-
# some_person.age
|
|
14
|
-
# => 26
|
|
15
|
-
#
|
|
16
|
-
# To give attribute <tt>:element_name</tt> a dynamic default value, evaluated
|
|
17
|
-
# in scope of self:
|
|
18
|
-
#
|
|
19
|
-
# attr_accessor_with_default(:element_name) { name.underscore }
|
|
20
|
-
#
|
|
21
|
-
def attr_accessor_with_default(sym, default = nil, &block)
|
|
22
|
-
raise 'Default value or block required' unless !default.nil? || block
|
|
23
|
-
define_method(sym, block_given? ? block : Proc.new { default })
|
|
24
|
-
module_eval(<<-EVAL, __FILE__, __LINE__)
|
|
25
|
-
def #{sym}=(value)
|
|
26
|
-
class << self; attr_reader :#{sym} end
|
|
27
|
-
@#{sym} = value
|
|
28
|
-
end
|
|
29
|
-
EVAL
|
|
30
|
-
end
|
|
31
|
-
end
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
class Module
|
|
2
|
-
# Declares an attribute reader backed by an internally-named instance variable.
|
|
3
|
-
def attr_internal_reader(*attrs)
|
|
4
|
-
attrs.each do |attr|
|
|
5
|
-
module_eval "def #{attr}() #{attr_internal_ivar_name(attr)} end"
|
|
6
|
-
end
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
# Declares an attribute writer backed by an internally-named instance variable.
|
|
10
|
-
def attr_internal_writer(*attrs)
|
|
11
|
-
attrs.each do |attr|
|
|
12
|
-
module_eval "def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end"
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
# Declares an attribute reader and writer backed by an internally-named instance
|
|
17
|
-
# variable.
|
|
18
|
-
def attr_internal_accessor(*attrs)
|
|
19
|
-
attr_internal_reader(*attrs)
|
|
20
|
-
attr_internal_writer(*attrs)
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
alias_method :attr_internal, :attr_internal_accessor
|
|
24
|
-
|
|
25
|
-
private
|
|
26
|
-
mattr_accessor :attr_internal_naming_format
|
|
27
|
-
self.attr_internal_naming_format = '@_%s'
|
|
28
|
-
|
|
29
|
-
def attr_internal_ivar_name(attr)
|
|
30
|
-
attr_internal_naming_format % attr
|
|
31
|
-
end
|
|
32
|
-
end
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
# Extends the module object with module and instance accessors for class attributes,
|
|
2
|
-
# just like the native attr* accessors for instance attributes.
|
|
3
|
-
#
|
|
4
|
-
# module AppConfiguration
|
|
5
|
-
# mattr_accessor :google_api_key
|
|
6
|
-
# self.google_api_key = "123456789"
|
|
7
|
-
#
|
|
8
|
-
# mattr_accessor :paypal_url
|
|
9
|
-
# self.paypal_url = "www.sandbox.paypal.com"
|
|
10
|
-
# end
|
|
11
|
-
#
|
|
12
|
-
# AppConfiguration.google_api_key = "overriding the api key!"
|
|
13
|
-
class Module
|
|
14
|
-
def mattr_reader(*syms)
|
|
15
|
-
syms.each do |sym|
|
|
16
|
-
next if sym.is_a?(Hash)
|
|
17
|
-
class_eval(<<-EOS, __FILE__, __LINE__)
|
|
18
|
-
unless defined? @@#{sym}
|
|
19
|
-
@@#{sym} = nil
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def self.#{sym}
|
|
23
|
-
@@#{sym}
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def #{sym}
|
|
27
|
-
@@#{sym}
|
|
28
|
-
end
|
|
29
|
-
EOS
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
def mattr_writer(*syms)
|
|
34
|
-
options = syms.extract_options!
|
|
35
|
-
syms.each do |sym|
|
|
36
|
-
class_eval(<<-EOS, __FILE__, __LINE__)
|
|
37
|
-
unless defined? @@#{sym}
|
|
38
|
-
@@#{sym} = nil
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
def self.#{sym}=(obj)
|
|
42
|
-
@@#{sym} = obj
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
#{"
|
|
46
|
-
def #{sym}=(obj)
|
|
47
|
-
@@#{sym} = obj
|
|
48
|
-
end
|
|
49
|
-
" unless options[:instance_writer] == false }
|
|
50
|
-
EOS
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
def mattr_accessor(*syms)
|
|
55
|
-
mattr_reader(*syms)
|
|
56
|
-
mattr_writer(*syms)
|
|
57
|
-
end
|
|
58
|
-
end
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
class Module
|
|
2
|
-
# Provides a delegate class method to easily expose contained objects' methods
|
|
3
|
-
# as your own. Pass one or more methods (specified as symbols or strings)
|
|
4
|
-
# and the name of the target object as the final <tt>:to</tt> option (also a symbol
|
|
5
|
-
# or string). At least one method and the <tt>:to</tt> option are required.
|
|
6
|
-
#
|
|
7
|
-
# Delegation is particularly useful with Active Record associations:
|
|
8
|
-
#
|
|
9
|
-
# class Greeter < ActiveRecord::Base
|
|
10
|
-
# def hello() "hello" end
|
|
11
|
-
# def goodbye() "goodbye" end
|
|
12
|
-
# end
|
|
13
|
-
#
|
|
14
|
-
# class Foo < ActiveRecord::Base
|
|
15
|
-
# belongs_to :greeter
|
|
16
|
-
# delegate :hello, :to => :greeter
|
|
17
|
-
# end
|
|
18
|
-
#
|
|
19
|
-
# Foo.new.hello # => "hello"
|
|
20
|
-
# Foo.new.goodbye # => NoMethodError: undefined method `goodbye' for #<Foo:0x1af30c>
|
|
21
|
-
#
|
|
22
|
-
# Multiple delegates to the same target are allowed:
|
|
23
|
-
#
|
|
24
|
-
# class Foo < ActiveRecord::Base
|
|
25
|
-
# belongs_to :greeter
|
|
26
|
-
# delegate :hello, :goodbye, :to => :greeter
|
|
27
|
-
# end
|
|
28
|
-
#
|
|
29
|
-
# Foo.new.goodbye # => "goodbye"
|
|
30
|
-
#
|
|
31
|
-
# Methods can be delegated to instance variables, class variables, or constants
|
|
32
|
-
# by providing them as a symbols:
|
|
33
|
-
#
|
|
34
|
-
# class Foo
|
|
35
|
-
# CONSTANT_ARRAY = [0,1,2,3]
|
|
36
|
-
# @@class_array = [4,5,6,7]
|
|
37
|
-
#
|
|
38
|
-
# def initialize
|
|
39
|
-
# @instance_array = [8,9,10,11]
|
|
40
|
-
# end
|
|
41
|
-
# delegate :sum, :to => :CONSTANT_ARRAY
|
|
42
|
-
# delegate :min, :to => :@@class_array
|
|
43
|
-
# delegate :max, :to => :@instance_array
|
|
44
|
-
# end
|
|
45
|
-
#
|
|
46
|
-
# Foo.new.sum # => 6
|
|
47
|
-
# Foo.new.min # => 4
|
|
48
|
-
# Foo.new.max # => 11
|
|
49
|
-
#
|
|
50
|
-
# Delegates can optionally be prefixed using the <tt>:prefix</tt> option. If the value
|
|
51
|
-
# is <tt>true</tt>, the delegate methods are prefixed with the name of the object being
|
|
52
|
-
# delegated to.
|
|
53
|
-
#
|
|
54
|
-
# Person = Struct.new(:name, :address)
|
|
55
|
-
#
|
|
56
|
-
# class Invoice < Struct.new(:client)
|
|
57
|
-
# delegate :name, :address, :to => :client, :prefix => true
|
|
58
|
-
# end
|
|
59
|
-
#
|
|
60
|
-
# john_doe = Person.new("John Doe", "Vimmersvej 13")
|
|
61
|
-
# invoice = Invoice.new(john_doe)
|
|
62
|
-
# invoice.client_name # => "John Doe"
|
|
63
|
-
# invoice.client_address # => "Vimmersvej 13"
|
|
64
|
-
#
|
|
65
|
-
# It is also possible to supply a custom prefix.
|
|
66
|
-
#
|
|
67
|
-
# class Invoice < Struct.new(:client)
|
|
68
|
-
# delegate :name, :address, :to => :client, :prefix => :customer
|
|
69
|
-
# end
|
|
70
|
-
#
|
|
71
|
-
# invoice = Invoice.new(john_doe)
|
|
72
|
-
# invoice.customer_name # => "John Doe"
|
|
73
|
-
# invoice.customer_address # => "Vimmersvej 13"
|
|
74
|
-
#
|
|
75
|
-
def delegate(*methods)
|
|
76
|
-
options = methods.pop
|
|
77
|
-
unless options.is_a?(Hash) && to = options[:to]
|
|
78
|
-
raise ArgumentError, "Delegation needs a target. Supply an options hash with a :to key as the last argument (e.g. delegate :hello, :to => :greeter)."
|
|
79
|
-
end
|
|
80
|
-
|
|
81
|
-
if options[:prefix] == true && options[:to].to_s =~ /^[^a-z_]/
|
|
82
|
-
raise ArgumentError, "Can only automatically set the delegation prefix when delegating to a method."
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
prefix = options[:prefix] && "#{options[:prefix] == true ? to : options[:prefix]}_"
|
|
86
|
-
|
|
87
|
-
methods.each do |method|
|
|
88
|
-
module_eval(<<-EOS, "(__DELEGATION__)", 1)
|
|
89
|
-
def #{prefix}#{method}(*args, &block)
|
|
90
|
-
#{to}.__send__(#{method.inspect}, *args, &block)
|
|
91
|
-
end
|
|
92
|
-
EOS
|
|
93
|
-
end
|
|
94
|
-
end
|
|
95
|
-
end
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
class Module
|
|
2
|
-
# Returns the classes in the current ObjectSpace where this module has been
|
|
3
|
-
# mixed in according to Module#included_modules.
|
|
4
|
-
#
|
|
5
|
-
# module M
|
|
6
|
-
# end
|
|
7
|
-
#
|
|
8
|
-
# module N
|
|
9
|
-
# include M
|
|
10
|
-
# end
|
|
11
|
-
#
|
|
12
|
-
# class C
|
|
13
|
-
# include M
|
|
14
|
-
# end
|
|
15
|
-
#
|
|
16
|
-
# class D < C
|
|
17
|
-
# end
|
|
18
|
-
#
|
|
19
|
-
# p M.included_in_classes # => [C, D]
|
|
20
|
-
#
|
|
21
|
-
def included_in_classes
|
|
22
|
-
classes = []
|
|
23
|
-
ObjectSpace.each_object(Class) { |k| classes << k if k.included_modules.include?(self) }
|
|
24
|
-
|
|
25
|
-
classes.reverse.inject([]) do |unique_classes, klass|
|
|
26
|
-
unique_classes << klass unless unique_classes.collect { |k| k.to_s }.include?(klass.to_s)
|
|
27
|
-
unique_classes
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
module ActiveSupport
|
|
2
|
-
module CoreExtensions
|
|
3
|
-
module Module
|
|
4
|
-
# Returns the name of the module containing this one.
|
|
5
|
-
#
|
|
6
|
-
# p M::N.parent_name # => "M"
|
|
7
|
-
def parent_name
|
|
8
|
-
unless defined? @parent_name
|
|
9
|
-
@parent_name = name =~ /::[^:]+\Z/ ? $`.freeze : nil
|
|
10
|
-
end
|
|
11
|
-
@parent_name
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
# Returns the module which contains this one according to its name.
|
|
15
|
-
#
|
|
16
|
-
# module M
|
|
17
|
-
# module N
|
|
18
|
-
# end
|
|
19
|
-
# end
|
|
20
|
-
# X = M::N
|
|
21
|
-
#
|
|
22
|
-
# p M::N.parent # => M
|
|
23
|
-
# p X.parent # => M
|
|
24
|
-
#
|
|
25
|
-
# The parent of top-level and anonymous modules is Object.
|
|
26
|
-
#
|
|
27
|
-
# p M.parent # => Object
|
|
28
|
-
# p Module.new.parent # => Object
|
|
29
|
-
#
|
|
30
|
-
def parent
|
|
31
|
-
parent_name ? parent_name.constantize : Object
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
# Returns all the parents of this module according to its name, ordered from
|
|
35
|
-
# nested outwards. The receiver is not contained within the result.
|
|
36
|
-
#
|
|
37
|
-
# module M
|
|
38
|
-
# module N
|
|
39
|
-
# end
|
|
40
|
-
# end
|
|
41
|
-
# X = M::N
|
|
42
|
-
#
|
|
43
|
-
# p M.parents # => [Object]
|
|
44
|
-
# p M::N.parents # => [M, Object]
|
|
45
|
-
# p X.parents # => [M, Object]
|
|
46
|
-
#
|
|
47
|
-
def parents
|
|
48
|
-
parents = []
|
|
49
|
-
if parent_name
|
|
50
|
-
parts = parent_name.split('::')
|
|
51
|
-
until parts.empty?
|
|
52
|
-
parents << (parts * '::').constantize
|
|
53
|
-
parts.pop
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
parents << Object unless parents.include? Object
|
|
57
|
-
parents
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
if RUBY_VERSION < '1.9'
|
|
61
|
-
# Returns the constants that have been defined locally by this object and
|
|
62
|
-
# not in an ancestor. This method is exact if running under Ruby 1.9. In
|
|
63
|
-
# previous versions it may miss some constants if their definition in some
|
|
64
|
-
# ancestor is identical to their definition in the receiver.
|
|
65
|
-
def local_constants
|
|
66
|
-
inherited = {}
|
|
67
|
-
|
|
68
|
-
ancestors.each do |anc|
|
|
69
|
-
next if anc == self
|
|
70
|
-
anc.constants.each { |const| inherited[const] = anc.const_get(const) }
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
constants.select do |const|
|
|
74
|
-
!inherited.key?(const) || inherited[const].object_id != const_get(const).object_id
|
|
75
|
-
end
|
|
76
|
-
end
|
|
77
|
-
else
|
|
78
|
-
def local_constants #:nodoc:
|
|
79
|
-
constants(false)
|
|
80
|
-
end
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
# Returns the names of the constants defined locally rather than the
|
|
84
|
-
# constants themselves. See <tt>local_constants</tt>.
|
|
85
|
-
def local_constant_names
|
|
86
|
-
local_constants.map { |c| c.to_s }
|
|
87
|
-
end
|
|
88
|
-
end
|
|
89
|
-
end
|
|
90
|
-
end
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
class Module
|
|
2
|
-
# Returns String#underscore applied to the module name minus trailing classes.
|
|
3
|
-
#
|
|
4
|
-
# ActiveRecord.as_load_path # => "active_record"
|
|
5
|
-
# ActiveRecord::Associations.as_load_path # => "active_record/associations"
|
|
6
|
-
# ActiveRecord::Base.as_load_path # => "active_record" (Base is a class)
|
|
7
|
-
#
|
|
8
|
-
# The Kernel module gives an empty string by definition.
|
|
9
|
-
#
|
|
10
|
-
# Kernel.as_load_path # => ""
|
|
11
|
-
# Math.as_load_path # => "math"
|
|
12
|
-
def as_load_path
|
|
13
|
-
if self == Object || self == Kernel
|
|
14
|
-
''
|
|
15
|
-
elsif is_a? Class
|
|
16
|
-
parent == self ? '' : parent.as_load_path
|
|
17
|
-
else
|
|
18
|
-
name.split('::').collect do |word|
|
|
19
|
-
word.underscore
|
|
20
|
-
end * '/'
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
module ActiveSupport
|
|
2
|
-
class ModelName < String
|
|
3
|
-
attr_reader :singular, :plural, :cache_key, :partial_path
|
|
4
|
-
|
|
5
|
-
def initialize(name)
|
|
6
|
-
super
|
|
7
|
-
@singular = underscore.tr('/', '_').freeze
|
|
8
|
-
@plural = @singular.pluralize.freeze
|
|
9
|
-
@cache_key = tableize.freeze
|
|
10
|
-
@partial_path = "#{@cache_key}/#{demodulize.underscore}".freeze
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
module CoreExtensions
|
|
15
|
-
module Module
|
|
16
|
-
# Returns an ActiveSupport::ModelName object for module. It can be
|
|
17
|
-
# used to retrieve all kinds of naming-related information.
|
|
18
|
-
def model_name
|
|
19
|
-
@model_name ||= ModelName.new(name)
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
class Module
|
|
2
|
-
# Synchronize access around a method, delegating synchronization to a
|
|
3
|
-
# particular mutex. A mutex (either a Mutex, or any object that responds to
|
|
4
|
-
# #synchronize and yields to a block) must be provided as a final :with option.
|
|
5
|
-
# The :with option should be a symbol or string, and can represent a method,
|
|
6
|
-
# constant, or instance or class variable.
|
|
7
|
-
# Example:
|
|
8
|
-
# class SharedCache
|
|
9
|
-
# @@lock = Mutex.new
|
|
10
|
-
# def expire
|
|
11
|
-
# ...
|
|
12
|
-
# end
|
|
13
|
-
# synchronize :expire, :with => :@@lock
|
|
14
|
-
# end
|
|
15
|
-
def synchronize(*methods)
|
|
16
|
-
options = methods.extract_options!
|
|
17
|
-
unless options.is_a?(Hash) && with = options[:with]
|
|
18
|
-
raise ArgumentError, "Synchronization needs a mutex. Supply an options hash with a :with key as the last argument (e.g. synchronize :hello, :with => :@mutex)."
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
methods.each do |method|
|
|
22
|
-
aliased_method, punctuation = method.to_s.sub(/([?!=])$/, ''), $1
|
|
23
|
-
|
|
24
|
-
if method_defined?("#{aliased_method}_without_synchronization#{punctuation}")
|
|
25
|
-
raise ArgumentError, "#{method} is already synchronized. Double synchronization is not currently supported."
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
module_eval(<<-EOS, __FILE__, __LINE__)
|
|
29
|
-
def #{aliased_method}_with_synchronization#{punctuation}(*args, &block)
|
|
30
|
-
#{with}.synchronize do
|
|
31
|
-
#{aliased_method}_without_synchronization#{punctuation}(*args, &block)
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
EOS
|
|
35
|
-
|
|
36
|
-
alias_method_chain method, :synchronization
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
end
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
require 'active_support/core_ext/module/inclusion'
|
|
2
|
-
require 'active_support/core_ext/module/attribute_accessors'
|
|
3
|
-
require 'active_support/core_ext/module/attr_internal'
|
|
4
|
-
require 'active_support/core_ext/module/attr_accessor_with_default'
|
|
5
|
-
require 'active_support/core_ext/module/delegation'
|
|
6
|
-
require 'active_support/core_ext/module/introspection'
|
|
7
|
-
require 'active_support/core_ext/module/loading'
|
|
8
|
-
require 'active_support/core_ext/module/aliasing'
|
|
9
|
-
require 'active_support/core_ext/module/model_naming'
|
|
10
|
-
require 'active_support/core_ext/module/synchronization'
|
|
11
|
-
|
|
12
|
-
module ActiveSupport
|
|
13
|
-
module CoreExtensions
|
|
14
|
-
# Various extensions for the Ruby core Module class.
|
|
15
|
-
module Module
|
|
16
|
-
# Nothing here. Only defined for API documentation purposes.
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
class Module
|
|
22
|
-
include ActiveSupport::CoreExtensions::Module
|
|
23
|
-
end
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
# Add a +missing_name+ method to NameError instances.
|
|
2
|
-
class NameError #:nodoc:
|
|
3
|
-
# Add a method to obtain the missing name from a NameError.
|
|
4
|
-
def missing_name
|
|
5
|
-
$1 if /((::)?([A-Z]\w*)(::[A-Z]\w*)*)$/ =~ message
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
# Was this exception raised because the given name was missing?
|
|
9
|
-
def missing_name?(name)
|
|
10
|
-
if name.is_a? Symbol
|
|
11
|
-
last_name = (missing_name || '').split('::').last
|
|
12
|
-
last_name == name.to_s
|
|
13
|
-
else
|
|
14
|
-
missing_name == name.to_s
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
module ActiveSupport #:nodoc:
|
|
2
|
-
module CoreExtensions #:nodoc:
|
|
3
|
-
module Numeric #:nodoc:
|
|
4
|
-
# Enables the use of byte calculations and declarations, like 45.bytes + 2.6.megabytes
|
|
5
|
-
module Bytes
|
|
6
|
-
def bytes
|
|
7
|
-
self
|
|
8
|
-
end
|
|
9
|
-
alias :byte :bytes
|
|
10
|
-
|
|
11
|
-
def kilobytes
|
|
12
|
-
self * 1024
|
|
13
|
-
end
|
|
14
|
-
alias :kilobyte :kilobytes
|
|
15
|
-
|
|
16
|
-
def megabytes
|
|
17
|
-
self * 1024.kilobytes
|
|
18
|
-
end
|
|
19
|
-
alias :megabyte :megabytes
|
|
20
|
-
|
|
21
|
-
def gigabytes
|
|
22
|
-
self * 1024.megabytes
|
|
23
|
-
end
|
|
24
|
-
alias :gigabyte :gigabytes
|
|
25
|
-
|
|
26
|
-
def terabytes
|
|
27
|
-
self * 1024.gigabytes
|
|
28
|
-
end
|
|
29
|
-
alias :terabyte :terabytes
|
|
30
|
-
|
|
31
|
-
def petabytes
|
|
32
|
-
self * 1024.terabytes
|
|
33
|
-
end
|
|
34
|
-
alias :petabyte :petabytes
|
|
35
|
-
|
|
36
|
-
def exabytes
|
|
37
|
-
self * 1024.petabytes
|
|
38
|
-
end
|
|
39
|
-
alias :exabyte :exabytes
|
|
40
|
-
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
end
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
module ActiveSupport #:nodoc:
|
|
2
|
-
module CoreExtensions #:nodoc:
|
|
3
|
-
module Numeric #:nodoc:
|
|
4
|
-
module Conversions
|
|
5
|
-
# Assumes self represents an offset from UTC in seconds (as returned from Time#utc_offset)
|
|
6
|
-
# and turns this into an +HH:MM formatted string. Example:
|
|
7
|
-
#
|
|
8
|
-
# -21_600.to_utc_offset_s # => "-06:00"
|
|
9
|
-
def to_utc_offset_s(colon=true)
|
|
10
|
-
seconds = self
|
|
11
|
-
sign = (seconds < 0 ? -1 : 1)
|
|
12
|
-
hours = seconds.abs / 3600
|
|
13
|
-
minutes = (seconds.abs % 3600) / 60
|
|
14
|
-
"%+03d%s%02d" % [ hours * sign, colon ? ":" : "", minutes ]
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
end
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
module ActiveSupport #:nodoc:
|
|
2
|
-
module CoreExtensions #:nodoc:
|
|
3
|
-
module Numeric #: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 seconds
|
|
34
|
-
ActiveSupport::Duration.new(self, [[:seconds, self]])
|
|
35
|
-
end
|
|
36
|
-
alias :second :seconds
|
|
37
|
-
|
|
38
|
-
def minutes
|
|
39
|
-
ActiveSupport::Duration.new(self * 60, [[:seconds, self * 60]])
|
|
40
|
-
end
|
|
41
|
-
alias :minute :minutes
|
|
42
|
-
|
|
43
|
-
def hours
|
|
44
|
-
ActiveSupport::Duration.new(self * 3600, [[:seconds, self * 3600]])
|
|
45
|
-
end
|
|
46
|
-
alias :hour :hours
|
|
47
|
-
|
|
48
|
-
def days
|
|
49
|
-
ActiveSupport::Duration.new(self * 24.hours, [[:days, self]])
|
|
50
|
-
end
|
|
51
|
-
alias :day :days
|
|
52
|
-
|
|
53
|
-
def weeks
|
|
54
|
-
ActiveSupport::Duration.new(self * 7.days, [[:days, self * 7]])
|
|
55
|
-
end
|
|
56
|
-
alias :week :weeks
|
|
57
|
-
|
|
58
|
-
def fortnights
|
|
59
|
-
ActiveSupport::Duration.new(self * 2.weeks, [[:days, self * 14]])
|
|
60
|
-
end
|
|
61
|
-
alias :fortnight :fortnights
|
|
62
|
-
|
|
63
|
-
# Reads best without arguments: 10.minutes.ago
|
|
64
|
-
def ago(time = ::Time.now)
|
|
65
|
-
time - self
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
# Reads best with argument: 10.minutes.until(time)
|
|
69
|
-
alias :until :ago
|
|
70
|
-
|
|
71
|
-
# Reads best with argument: 10.minutes.since(time)
|
|
72
|
-
def since(time = ::Time.now)
|
|
73
|
-
time + self
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
# Reads best without arguments: 10.minutes.from_now
|
|
77
|
-
alias :from_now :since
|
|
78
|
-
end
|
|
79
|
-
end
|
|
80
|
-
end
|
|
81
|
-
end
|