mack-active_record 0.8.1 → 0.8.2
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/gems/activerecord-2.2.2/lib/active_record/aggregations.rb +261 -0
- data/lib/gems/activerecord-2.2.2/lib/active_record/association_preload.rb +374 -0
- data/lib/gems/activerecord-2.2.2/lib/active_record/associations/association_collection.rb +453 -0
- data/lib/gems/activerecord-2.2.2/lib/active_record/associations/association_proxy.rb +272 -0
- data/lib/gems/activerecord-2.2.2/lib/active_record/associations/belongs_to_association.rb +58 -0
- data/lib/gems/activerecord-2.2.2/lib/active_record/associations/belongs_to_polymorphic_association.rb +49 -0
- data/lib/gems/activerecord-2.2.2/lib/active_record/associations/has_and_belongs_to_many_association.rb +121 -0
- data/lib/gems/activerecord-2.2.2/lib/active_record/associations/has_many_association.rb +121 -0
- data/lib/gems/activerecord-2.2.2/lib/active_record/associations/has_many_through_association.rb +256 -0
- data/lib/gems/activerecord-2.2.2/lib/active_record/associations/has_one_association.rb +115 -0
- data/lib/gems/activerecord-2.2.2/lib/active_record/associations/has_one_through_association.rb +31 -0
- data/lib/gems/activerecord-2.2.2/lib/active_record/associations.rb +2227 -0
- data/lib/gems/activerecord-2.2.2/lib/active_record/attribute_methods.rb +387 -0
- data/lib/gems/activerecord-2.2.2/lib/active_record/base.rb +2967 -0
- data/lib/gems/activerecord-2.2.2/lib/active_record/calculations.rb +299 -0
- data/lib/gems/activerecord-2.2.2/lib/active_record/callbacks.rb +331 -0
- data/lib/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb +355 -0
- data/lib/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/connection_specification.rb +136 -0
- data/lib/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/database_statements.rb +201 -0
- data/lib/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/query_cache.rb +94 -0
- data/lib/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/quoting.rb +69 -0
- data/lib/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/schema_definitions.rb +705 -0
- data/lib/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/schema_statements.rb +434 -0
- data/lib/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract_adapter.rb +210 -0
- data/lib/gems/activerecord-2.2.2/lib/active_record/connection_adapters/mysql_adapter.rb +585 -0
- data/lib/gems/activerecord-2.2.2/lib/active_record/connection_adapters/postgresql_adapter.rb +1065 -0
- data/lib/gems/activerecord-2.2.2/lib/active_record/connection_adapters/sqlite3_adapter.rb +34 -0
- data/lib/gems/activerecord-2.2.2/lib/active_record/connection_adapters/sqlite_adapter.rb +418 -0
- data/lib/gems/activerecord-2.2.2/lib/active_record/dirty.rb +183 -0
- data/lib/gems/activerecord-2.2.2/lib/active_record/dynamic_finder_match.rb +41 -0
- data/lib/gems/activerecord-2.2.2/lib/active_record/fixtures.rb +998 -0
- data/lib/gems/activerecord-2.2.2/lib/active_record/i18n_interpolation_deprecation.rb +26 -0
- data/lib/gems/activerecord-2.2.2/lib/active_record/locale/en.yml +54 -0
- data/lib/gems/activerecord-2.2.2/lib/active_record/locking/optimistic.rb +148 -0
- data/lib/gems/activerecord-2.2.2/lib/active_record/locking/pessimistic.rb +77 -0
- data/lib/gems/activerecord-2.2.2/lib/active_record/migration.rb +560 -0
- data/lib/gems/activerecord-2.2.2/lib/active_record/named_scope.rb +181 -0
- data/lib/gems/activerecord-2.2.2/lib/active_record/observer.rb +197 -0
- data/lib/gems/activerecord-2.2.2/lib/active_record/query_cache.rb +21 -0
- data/lib/gems/activerecord-2.2.2/lib/active_record/reflection.rb +307 -0
- data/lib/gems/activerecord-2.2.2/lib/active_record/schema.rb +51 -0
- data/lib/gems/activerecord-2.2.2/lib/active_record/schema_dumper.rb +177 -0
- data/lib/gems/activerecord-2.2.2/lib/active_record/serialization.rb +98 -0
- data/lib/gems/activerecord-2.2.2/lib/active_record/serializers/json_serializer.rb +80 -0
- data/lib/gems/activerecord-2.2.2/lib/active_record/serializers/xml_serializer.rb +338 -0
- data/lib/gems/activerecord-2.2.2/lib/active_record/test_case.rb +60 -0
- data/lib/gems/activerecord-2.2.2/lib/active_record/timestamp.rb +41 -0
- data/lib/gems/activerecord-2.2.2/lib/active_record/transactions.rb +185 -0
- data/lib/gems/activerecord-2.2.2/lib/active_record/validations.rb +1061 -0
- data/lib/gems/activerecord-2.2.2/lib/active_record/version.rb +9 -0
- data/lib/gems/activerecord-2.2.2/lib/active_record.rb +81 -0
- data/lib/gems/activerecord-2.2.2/lib/activerecord.rb +1 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/base64.rb +33 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/basic_object.rb +24 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/buffered_logger.rb +122 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/cache/compressed_mem_cache_store.rb +20 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/cache/drb_store.rb +15 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/cache/file_store.rb +72 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/cache/mem_cache_store.rb +127 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/cache/memory_store.rb +52 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/cache/synchronized_memory_store.rb +47 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/cache.rb +223 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/callbacks.rb +280 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/array/access.rb +53 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/array/conversions.rb +183 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/array/extract_options.rb +20 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/array/grouping.rb +106 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/array/random_access.rb +12 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/array.rb +13 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/base64/encoding.rb +16 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/base64.rb +4 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/benchmark.rb +12 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/bigdecimal/conversions.rb +37 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/bigdecimal.rb +6 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/blank.rb +58 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/cgi/escape_skipping_slashes.rb +14 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/cgi.rb +5 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/class/attribute_accessors.rb +54 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/class/delegating_attributes.rb +46 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/class/inheritable_attributes.rb +140 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/class/removal.rb +50 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/class.rb +4 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/date/behavior.rb +42 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/date/calculations.rb +230 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/date/conversions.rb +107 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/date.rb +10 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/date_time/calculations.rb +126 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/date_time/conversions.rb +96 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/date_time.rb +12 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/duplicable.rb +43 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/enumerable.rb +107 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/exception.rb +41 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/file/atomic.rb +46 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/file.rb +5 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/float/rounding.rb +24 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/float/time.rb +27 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/float.rb +7 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/hash/conversions.rb +259 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/hash/deep_merge.rb +23 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/hash/diff.rb +19 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/hash/except.rb +25 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/hash/indifferent_access.rb +137 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/hash/keys.rb +52 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/hash/reverse_merge.rb +35 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/hash/slice.rb +33 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/hash.rb +14 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/integer/even_odd.rb +29 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/integer/inflections.rb +20 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/integer/time.rb +45 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/integer.rb +9 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/kernel/agnostics.rb +11 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/kernel/daemonizing.rb +7 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/kernel/debugger.rb +13 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/kernel/reporting.rb +59 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/kernel/requires.rb +24 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/kernel.rb +5 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/load_error.rb +38 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/logger.rb +143 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/module/aliasing.rb +74 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/module/attr_accessor_with_default.rb +31 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/module/attr_internal.rb +32 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/module/attribute_accessors.rb +58 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/module/delegation.rb +95 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/module/inclusion.rb +30 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/module/introspection.rb +90 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/module/loading.rb +23 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/module/model_naming.rb +23 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/module/synchronization.rb +39 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/module.rb +23 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/name_error.rb +17 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/numeric/bytes.rb +44 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/numeric/conversions.rb +19 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/numeric/time.rb +81 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/numeric.rb +9 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/object/conversions.rb +14 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/object/extending.rb +80 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/object/instance_variables.rb +74 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/object/metaclass.rb +13 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/object/misc.rb +74 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/object.rb +5 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/pathname/clean_within.rb +14 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/pathname.rb +7 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/proc.rb +12 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/process/daemon.rb +25 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/process.rb +1 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/range/blockless_step.rb +32 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/range/conversions.rb +27 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/range/include_range.rb +30 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/range/overlaps.rb +15 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/range.rb +11 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/rexml.rb +36 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/string/access.rb +82 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/string/behavior.rb +13 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/string/conversions.rb +28 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/string/filters.rb +26 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/string/inflections.rb +167 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/string/iterators.rb +21 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/string/multibyte.rb +81 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/string/starts_ends_with.rb +35 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/string/xchar.rb +11 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/string.rb +22 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/symbol.rb +14 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/time/behavior.rb +13 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/time/calculations.rb +303 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/time/conversions.rb +90 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/time/zones.rb +86 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext/time.rb +42 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/core_ext.rb +4 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/dependencies.rb +621 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/deprecation.rb +243 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/duration.rb +96 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/gzip.rb +25 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/inflections.rb +55 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/inflector.rb +397 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/json/decoding.rb +63 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/json/encoders/date.rb +21 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/json/encoders/date_time.rb +21 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/json/encoders/enumerable.rb +12 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/json/encoders/false_class.rb +5 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/json/encoders/hash.rb +47 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/json/encoders/nil_class.rb +5 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/json/encoders/numeric.rb +5 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/json/encoders/object.rb +6 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/json/encoders/regexp.rb +5 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/json/encoders/string.rb +36 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/json/encoders/symbol.rb +5 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/json/encoders/time.rb +21 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/json/encoders/true_class.rb +5 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/json/encoding.rb +37 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/json/variable.rb +10 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/json.rb +23 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/locale/en.yml +32 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/memoizable.rb +82 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/multibyte/chars.rb +679 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/multibyte/exceptions.rb +8 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/multibyte/unicode_database.rb +71 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/multibyte.rb +33 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/option_merger.rb +17 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/ordered_hash.rb +58 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/ordered_options.rb +19 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/rescuable.rb +108 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/secure_random.rb +197 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/string_inquirer.rb +21 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/test_case.rb +24 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/testing/core_ext/test/unit/assertions.rb +72 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/testing/core_ext/test.rb +6 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/testing/default.rb +9 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/testing/performance.rb +452 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/testing/setup_and_teardown.rb +120 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/time_with_zone.rb +328 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/values/time_zone.rb +403 -0
- 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 +113 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/builder-2.1.2/builder/blankslate.rb +20 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/builder-2.1.2/builder/css.rb +250 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/builder-2.1.2/builder/xchar.rb +115 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/builder-2.1.2/builder/xmlbase.rb +139 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/builder-2.1.2/builder/xmlevents.rb +63 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/builder-2.1.2/builder/xmlmarkup.rb +328 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/builder-2.1.2/builder.rb +13 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb +216 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/i18n-0.0.1/i18n/exceptions.rb +53 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/i18n-0.0.1/i18n.rb +194 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/memcache-client-1.5.1/memcache.rb +849 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/data_timezone.rb +47 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/data_timezone_info.rb +228 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Algiers.rb +55 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Cairo.rb +219 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Casablanca.rb +40 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Harare.rb +18 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Johannesburg.rb +25 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Monrovia.rb +22 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Nairobi.rb +23 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Argentina/Buenos_Aires.rb +166 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Argentina/San_Juan.rb +86 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Bogota.rb +23 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Caracas.rb +23 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Chicago.rb +283 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Chihuahua.rb +136 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Denver.rb +204 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Godthab.rb +161 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Guatemala.rb +27 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Halifax.rb +274 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Indiana/Indianapolis.rb +149 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Juneau.rb +194 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/La_Paz.rb +22 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Lima.rb +35 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Los_Angeles.rb +232 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Mazatlan.rb +139 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Mexico_City.rb +144 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Monterrey.rb +131 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/New_York.rb +282 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Phoenix.rb +30 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Regina.rb +74 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Santiago.rb +205 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Sao_Paulo.rb +171 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/St_Johns.rb +288 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Tijuana.rb +196 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Almaty.rb +67 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Baghdad.rb +73 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Baku.rb +161 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Bangkok.rb +20 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Chongqing.rb +33 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Colombo.rb +30 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Dhaka.rb +27 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Hong_Kong.rb +87 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Irkutsk.rb +165 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Jakarta.rb +30 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Jerusalem.rb +163 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kabul.rb +20 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kamchatka.rb +163 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Karachi.rb +30 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Katmandu.rb +20 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kolkata.rb +25 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Krasnoyarsk.rb +163 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kuala_Lumpur.rb +31 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kuwait.rb +18 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Magadan.rb +163 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Muscat.rb +18 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Novosibirsk.rb +164 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Rangoon.rb +24 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Riyadh.rb +18 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Seoul.rb +34 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Shanghai.rb +35 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Singapore.rb +33 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Taipei.rb +59 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Tashkent.rb +47 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Tbilisi.rb +78 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Tehran.rb +121 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Tokyo.rb +30 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Ulaanbaatar.rb +65 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Urumqi.rb +33 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Vladivostok.rb +164 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Yakutsk.rb +163 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Yekaterinburg.rb +165 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Yerevan.rb +165 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Atlantic/Azores.rb +270 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Atlantic/Cape_Verde.rb +23 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Atlantic/South_Georgia.rb +18 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Adelaide.rb +187 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Brisbane.rb +35 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Darwin.rb +29 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Hobart.rb +193 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Melbourne.rb +185 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Perth.rb +37 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Sydney.rb +185 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Etc/UTC.rb +16 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Amsterdam.rb +228 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Athens.rb +185 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Belgrade.rb +163 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Berlin.rb +188 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Bratislava.rb +13 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Brussels.rb +232 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Bucharest.rb +181 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Budapest.rb +197 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Copenhagen.rb +179 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Dublin.rb +276 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Helsinki.rb +163 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Istanbul.rb +218 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Kiev.rb +168 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Lisbon.rb +268 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Ljubljana.rb +13 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/London.rb +288 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Madrid.rb +211 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Minsk.rb +170 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Moscow.rb +181 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Paris.rb +232 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Prague.rb +187 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Riga.rb +176 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Rome.rb +215 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Sarajevo.rb +13 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Skopje.rb +13 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Sofia.rb +173 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Stockholm.rb +165 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Tallinn.rb +172 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Vienna.rb +183 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Vilnius.rb +170 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Warsaw.rb +212 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Zagreb.rb +13 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Auckland.rb +202 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Fiji.rb +23 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Guam.rb +22 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Honolulu.rb +28 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Majuro.rb +20 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Midway.rb +25 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Noumea.rb +25 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Pago_Pago.rb +26 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Port_Moresby.rb +20 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Tongatapu.rb +27 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/info_timezone.rb +52 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/linked_timezone.rb +51 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/linked_timezone_info.rb +44 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/offset_rationals.rb +98 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/ruby_core_support.rb +56 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/time_or_datetime.rb +292 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone.rb +508 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_definition.rb +56 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_info.rb +40 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_offset_info.rb +94 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_period.rb +198 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_transition_info.rb +129 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/tzinfo-0.3.12/tzinfo.rb +33 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor/xml-simple-1.0.11/xmlsimple.rb +1021 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/vendor.rb +34 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/version.rb +9 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support/whiny_nil.rb +58 -0
- data/lib/gems/activesupport-2.2.2/lib/active_support.rb +61 -0
- data/lib/gems/activesupport-2.2.2/lib/activesupport.rb +1 -0
- data/lib/gems.rb +13 -0
- data/lib/mack-active_record/database.rb +4 -4
- data/lib/mack-active_record/migration_generator/migration_generator.rb +6 -2
- data/lib/mack-active_record/model_generator/manifest.yml +3 -3
- data/lib/mack-active_record/model_generator/model_generator.rb +8 -1
- data/lib/mack-active_record/model_generator/templates/model.rb.template +1 -1
- data/lib/mack-active_record/model_generator/templates/rspec.rb.template +1 -1
- data/lib/mack-active_record/model_generator/templates/test.rb.template +1 -1
- data/lib/mack-active_record.rb +3 -1
- data/lib/mack-active_record_tasks.rb +3 -0
- metadata +457 -16
|
@@ -0,0 +1,90 @@
|
|
|
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
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
|
@@ -0,0 +1,44 @@
|
|
|
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
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
|
@@ -0,0 +1,81 @@
|
|
|
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
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
require 'active_support/core_ext/numeric/time'
|
|
2
|
+
require 'active_support/core_ext/numeric/bytes'
|
|
3
|
+
require 'active_support/core_ext/numeric/conversions'
|
|
4
|
+
|
|
5
|
+
class Numeric #:nodoc:
|
|
6
|
+
include ActiveSupport::CoreExtensions::Numeric::Time
|
|
7
|
+
include ActiveSupport::CoreExtensions::Numeric::Bytes
|
|
8
|
+
include ActiveSupport::CoreExtensions::Numeric::Conversions
|
|
9
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
class Object
|
|
2
|
+
# Alias of <tt>to_s</tt>.
|
|
3
|
+
def to_param
|
|
4
|
+
to_s
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
# Converts an object into a string suitable for use as a URL query string, using the given <tt>key</tt> as the
|
|
8
|
+
# param name.
|
|
9
|
+
#
|
|
10
|
+
# Note: This method is defined as a default implementation for all Objects for Hash#to_query to work.
|
|
11
|
+
def to_query(key)
|
|
12
|
+
"#{CGI.escape(key.to_s)}=#{CGI.escape(to_param.to_s)}"
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
class Object
|
|
2
|
+
def remove_subclasses_of(*superclasses) #:nodoc:
|
|
3
|
+
Class.remove_class(*subclasses_of(*superclasses))
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
begin
|
|
7
|
+
ObjectSpace.each_object(Class.new) {}
|
|
8
|
+
|
|
9
|
+
# Exclude this class unless it's a subclass of our supers and is defined.
|
|
10
|
+
# We check defined? in case we find a removed class that has yet to be
|
|
11
|
+
# garbage collected. This also fails for anonymous classes -- please
|
|
12
|
+
# submit a patch if you have a workaround.
|
|
13
|
+
def subclasses_of(*superclasses) #:nodoc:
|
|
14
|
+
subclasses = []
|
|
15
|
+
|
|
16
|
+
superclasses.each do |sup|
|
|
17
|
+
ObjectSpace.each_object(class << sup; self; end) do |k|
|
|
18
|
+
if k != sup && (k.name.blank? || eval("defined?(::#{k}) && ::#{k}.object_id == k.object_id"))
|
|
19
|
+
subclasses << k
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
subclasses
|
|
25
|
+
end
|
|
26
|
+
rescue RuntimeError
|
|
27
|
+
# JRuby and any implementations which cannot handle the objectspace traversal
|
|
28
|
+
# above fall back to this implementation
|
|
29
|
+
def subclasses_of(*superclasses) #:nodoc:
|
|
30
|
+
subclasses = []
|
|
31
|
+
|
|
32
|
+
superclasses.each do |sup|
|
|
33
|
+
ObjectSpace.each_object(Class) do |k|
|
|
34
|
+
if superclasses.any? { |superclass| k < superclass } &&
|
|
35
|
+
(k.name.blank? || eval("defined?(::#{k}) && ::#{k}.object_id == k.object_id"))
|
|
36
|
+
subclasses << k
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
subclasses.uniq!
|
|
40
|
+
end
|
|
41
|
+
subclasses
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def extended_by #:nodoc:
|
|
46
|
+
ancestors = class << self; ancestors end
|
|
47
|
+
ancestors.select { |mod| mod.class == Module } - [ Object, Kernel ]
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def extend_with_included_modules_from(object) #:nodoc:
|
|
51
|
+
object.extended_by.each { |mod| extend mod }
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
unless defined? instance_exec # 1.9
|
|
55
|
+
module InstanceExecMethods #:nodoc:
|
|
56
|
+
end
|
|
57
|
+
include InstanceExecMethods
|
|
58
|
+
|
|
59
|
+
# Evaluate the block with the given arguments within the context of
|
|
60
|
+
# this object, so self is set to the method receiver.
|
|
61
|
+
#
|
|
62
|
+
# From Mauricio's http://eigenclass.org/hiki/bounded+space+instance_exec
|
|
63
|
+
def instance_exec(*args, &block)
|
|
64
|
+
begin
|
|
65
|
+
old_critical, Thread.critical = Thread.critical, true
|
|
66
|
+
n = 0
|
|
67
|
+
n += 1 while respond_to?(method_name = "__instance_exec#{n}")
|
|
68
|
+
InstanceExecMethods.module_eval { define_method(method_name, &block) }
|
|
69
|
+
ensure
|
|
70
|
+
Thread.critical = old_critical
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
begin
|
|
74
|
+
send(method_name, *args)
|
|
75
|
+
ensure
|
|
76
|
+
InstanceExecMethods.module_eval { remove_method(method_name) } rescue nil
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
end
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
class Object
|
|
2
|
+
# Available in 1.8.6 and later.
|
|
3
|
+
unless respond_to?(:instance_variable_defined?)
|
|
4
|
+
def instance_variable_defined?(variable)
|
|
5
|
+
instance_variables.include?(variable.to_s)
|
|
6
|
+
end
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
# Returns a hash that maps instance variable names without "@" to their
|
|
10
|
+
# corresponding values. Keys are strings both in Ruby 1.8 and 1.9.
|
|
11
|
+
#
|
|
12
|
+
# class C
|
|
13
|
+
# def initialize(x, y)
|
|
14
|
+
# @x, @y = x, y
|
|
15
|
+
# end
|
|
16
|
+
# end
|
|
17
|
+
#
|
|
18
|
+
# C.new(0, 1).instance_values # => {"x" => 0, "y" => 1}
|
|
19
|
+
def instance_values #:nodoc:
|
|
20
|
+
instance_variables.inject({}) do |values, name|
|
|
21
|
+
values[name.to_s[1..-1]] = instance_variable_get(name)
|
|
22
|
+
values
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# Returns an array of instance variable names including "@". They are strings
|
|
27
|
+
# both in Ruby 1.8 and 1.9.
|
|
28
|
+
#
|
|
29
|
+
# class C
|
|
30
|
+
# def initialize(x, y)
|
|
31
|
+
# @x, @y = x, y
|
|
32
|
+
# end
|
|
33
|
+
# end
|
|
34
|
+
#
|
|
35
|
+
# C.new(0, 1).instance_variable_names # => ["@y", "@x"]
|
|
36
|
+
if RUBY_VERSION >= '1.9'
|
|
37
|
+
def instance_variable_names
|
|
38
|
+
instance_variables.map { |var| var.to_s }
|
|
39
|
+
end
|
|
40
|
+
else
|
|
41
|
+
alias_method :instance_variable_names, :instance_variables
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Copies the instance variables of +object+ into +self+.
|
|
45
|
+
#
|
|
46
|
+
# Instance variable names in the +exclude+ array are ignored. If +object+
|
|
47
|
+
# responds to <tt>protected_instance_variables</tt> the ones returned are
|
|
48
|
+
# also ignored. For example, Rails controllers implement that method.
|
|
49
|
+
#
|
|
50
|
+
# In both cases strings and symbols are understood, and they have to include
|
|
51
|
+
# the at sign.
|
|
52
|
+
#
|
|
53
|
+
# class C
|
|
54
|
+
# def initialize(x, y, z)
|
|
55
|
+
# @x, @y, @z = x, y, z
|
|
56
|
+
# end
|
|
57
|
+
#
|
|
58
|
+
# def protected_instance_variables
|
|
59
|
+
# %w(@z)
|
|
60
|
+
# end
|
|
61
|
+
# end
|
|
62
|
+
#
|
|
63
|
+
# a = C.new(0, 1, 2)
|
|
64
|
+
# b = C.new(3, 4, 5)
|
|
65
|
+
#
|
|
66
|
+
# a.copy_instance_variables_from(b, [:@y])
|
|
67
|
+
# # a is now: @x = 3, @y = 1, @z = 2
|
|
68
|
+
def copy_instance_variables_from(object, exclude = []) #:nodoc:
|
|
69
|
+
exclude += object.protected_instance_variables if object.respond_to? :protected_instance_variables
|
|
70
|
+
|
|
71
|
+
vars = object.instance_variables.map(&:to_s) - exclude.map(&:to_s)
|
|
72
|
+
vars.each { |name| instance_variable_set(name, object.instance_variable_get(name)) }
|
|
73
|
+
end
|
|
74
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
class Object
|
|
2
|
+
# Get object's meta (ghost, eigenclass, singleton) class
|
|
3
|
+
def metaclass
|
|
4
|
+
class << self
|
|
5
|
+
self
|
|
6
|
+
end
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
# If class_eval is called on an object, add those methods to its metaclass
|
|
10
|
+
def class_eval(*args, &block)
|
|
11
|
+
metaclass.class_eval(*args, &block)
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
class Object
|
|
2
|
+
# Returns +value+ after yielding +value+ to the block. This simplifies the
|
|
3
|
+
# process of constructing an object, performing work on the object, and then
|
|
4
|
+
# returning the object from a method. It is a Ruby-ized realization of the K
|
|
5
|
+
# combinator, courtesy of Mikael Brockman.
|
|
6
|
+
#
|
|
7
|
+
# ==== Examples
|
|
8
|
+
#
|
|
9
|
+
# # Without returning
|
|
10
|
+
# def foo
|
|
11
|
+
# values = []
|
|
12
|
+
# values << "bar"
|
|
13
|
+
# values << "baz"
|
|
14
|
+
# return values
|
|
15
|
+
# end
|
|
16
|
+
#
|
|
17
|
+
# foo # => ['bar', 'baz']
|
|
18
|
+
#
|
|
19
|
+
# # returning with a local variable
|
|
20
|
+
# def foo
|
|
21
|
+
# returning values = [] do
|
|
22
|
+
# values << 'bar'
|
|
23
|
+
# values << 'baz'
|
|
24
|
+
# end
|
|
25
|
+
# end
|
|
26
|
+
#
|
|
27
|
+
# foo # => ['bar', 'baz']
|
|
28
|
+
#
|
|
29
|
+
# # returning with a block argument
|
|
30
|
+
# def foo
|
|
31
|
+
# returning [] do |values|
|
|
32
|
+
# values << 'bar'
|
|
33
|
+
# values << 'baz'
|
|
34
|
+
# end
|
|
35
|
+
# end
|
|
36
|
+
#
|
|
37
|
+
# foo # => ['bar', 'baz']
|
|
38
|
+
def returning(value)
|
|
39
|
+
yield(value)
|
|
40
|
+
value
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# An elegant way to factor duplication out of options passed to a series of
|
|
44
|
+
# method calls. Each method called in the block, with the block variable as
|
|
45
|
+
# the receiver, will have its options merged with the default +options+ hash
|
|
46
|
+
# provided. Each method called on the block variable must take an options
|
|
47
|
+
# hash as its final argument.
|
|
48
|
+
#
|
|
49
|
+
# with_options :order => 'created_at', :class_name => 'Comment' do |post|
|
|
50
|
+
# post.has_many :comments, :conditions => ['approved = ?', true], :dependent => :delete_all
|
|
51
|
+
# post.has_many :unapproved_comments, :conditions => ['approved = ?', false]
|
|
52
|
+
# post.has_many :all_comments
|
|
53
|
+
# end
|
|
54
|
+
#
|
|
55
|
+
# Can also be used with an explicit receiver:
|
|
56
|
+
#
|
|
57
|
+
# map.with_options :controller => "people" do |people|
|
|
58
|
+
# people.connect "/people", :action => "index"
|
|
59
|
+
# people.connect "/people/:id", :action => "show"
|
|
60
|
+
# end
|
|
61
|
+
#
|
|
62
|
+
def with_options(options)
|
|
63
|
+
yield ActiveSupport::OptionMerger.new(self, options)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# A duck-type assistant method. For example, Active Support extends Date
|
|
67
|
+
# to define an acts_like_date? method, and extends Time to define
|
|
68
|
+
# acts_like_time?. As a result, we can do "x.acts_like?(:time)" and
|
|
69
|
+
# "x.acts_like?(:date)" to do duck-type-safe comparisons, since classes that
|
|
70
|
+
# we want to act like Time simply need to define an acts_like_time? method.
|
|
71
|
+
def acts_like?(duck)
|
|
72
|
+
respond_to? "acts_like_#{duck}?"
|
|
73
|
+
end
|
|
74
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module ActiveSupport #:nodoc:
|
|
2
|
+
module CoreExtensions #:nodoc:
|
|
3
|
+
module Pathname #:nodoc:
|
|
4
|
+
module CleanWithin
|
|
5
|
+
# Clean the paths contained in the provided string.
|
|
6
|
+
def clean_within(string)
|
|
7
|
+
string.gsub(%r{[\w. ]+(/[\w. ]+)+(\.rb)?(\b|$)}) do |path|
|
|
8
|
+
new(path).cleanpath
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
class Proc #:nodoc:
|
|
2
|
+
def bind(object)
|
|
3
|
+
block, time = self, Time.now
|
|
4
|
+
(class << object; self end).class_eval do
|
|
5
|
+
method_name = "__bind_#{time.to_i}_#{time.usec}"
|
|
6
|
+
define_method(method_name, &block)
|
|
7
|
+
method = instance_method(method_name)
|
|
8
|
+
remove_method(method_name)
|
|
9
|
+
method
|
|
10
|
+
end.bind(object)
|
|
11
|
+
end
|
|
12
|
+
end
|