mack-active_record 0.8.1 → 0.8.2
Sign up to get free protection for your applications and to get access to all the features.
- 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,71 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module ActiveSupport #:nodoc:
|
4
|
+
module Multibyte #:nodoc:
|
5
|
+
# Holds data about a codepoint in the Unicode database
|
6
|
+
class Codepoint
|
7
|
+
attr_accessor :code, :combining_class, :decomp_type, :decomp_mapping, :uppercase_mapping, :lowercase_mapping
|
8
|
+
end
|
9
|
+
|
10
|
+
# Holds static data from the Unicode database
|
11
|
+
class UnicodeDatabase
|
12
|
+
ATTRIBUTES = :codepoints, :composition_exclusion, :composition_map, :boundary, :cp1252
|
13
|
+
|
14
|
+
attr_writer(*ATTRIBUTES)
|
15
|
+
|
16
|
+
def initialize
|
17
|
+
@codepoints = Hash.new(Codepoint.new)
|
18
|
+
@composition_exclusion = []
|
19
|
+
@composition_map = {}
|
20
|
+
@boundary = {}
|
21
|
+
@cp1252 = {}
|
22
|
+
end
|
23
|
+
|
24
|
+
# Lazy load the Unicode database so it's only loaded when it's actually used
|
25
|
+
ATTRIBUTES.each do |attr_name|
|
26
|
+
class_eval(<<-EOS, __FILE__, __LINE__)
|
27
|
+
def #{attr_name}
|
28
|
+
load
|
29
|
+
@#{attr_name}
|
30
|
+
end
|
31
|
+
EOS
|
32
|
+
end
|
33
|
+
|
34
|
+
# Loads the Unicode database and returns all the internal objects of UnicodeDatabase.
|
35
|
+
def load
|
36
|
+
begin
|
37
|
+
@codepoints, @composition_exclusion, @composition_map, @boundary, @cp1252 = File.open(self.class.filename, 'rb') { |f| Marshal.load f.read }
|
38
|
+
rescue Exception => e
|
39
|
+
raise IOError.new("Couldn't load the Unicode tables for UTF8Handler (#{e.message}), ActiveSupport::Multibyte is unusable")
|
40
|
+
end
|
41
|
+
|
42
|
+
# Redefine the === method so we can write shorter rules for grapheme cluster breaks
|
43
|
+
@boundary.each do |k,_|
|
44
|
+
@boundary[k].instance_eval do
|
45
|
+
def ===(other)
|
46
|
+
detect { |i| i === other } ? true : false
|
47
|
+
end
|
48
|
+
end if @boundary[k].kind_of?(Array)
|
49
|
+
end
|
50
|
+
|
51
|
+
# define attr_reader methods for the instance variables
|
52
|
+
class << self
|
53
|
+
attr_reader(*ATTRIBUTES)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# Returns the directory in which the data files are stored
|
58
|
+
def self.dirname
|
59
|
+
File.dirname(__FILE__) + '/../values/'
|
60
|
+
end
|
61
|
+
|
62
|
+
# Returns the filename for the data file for this version
|
63
|
+
def self.filename
|
64
|
+
File.expand_path File.join(dirname, "unicode_tables.dat")
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
# UniCode Database
|
69
|
+
UCD = UnicodeDatabase.new
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'active_support/multibyte/chars'
|
4
|
+
require 'active_support/multibyte/exceptions'
|
5
|
+
require 'active_support/multibyte/unicode_database'
|
6
|
+
|
7
|
+
module ActiveSupport #:nodoc:
|
8
|
+
module Multibyte
|
9
|
+
# A list of all available normalization forms. See http://www.unicode.org/reports/tr15/tr15-29.html for more
|
10
|
+
# information about normalization.
|
11
|
+
NORMALIZATION_FORMS = [:c, :kc, :d, :kd]
|
12
|
+
|
13
|
+
# The Unicode version that is supported by the implementation
|
14
|
+
UNICODE_VERSION = '5.1.0'
|
15
|
+
|
16
|
+
# The default normalization used for operations that require normalization. It can be set to any of the
|
17
|
+
# normalizations in NORMALIZATION_FORMS.
|
18
|
+
#
|
19
|
+
# Example:
|
20
|
+
# ActiveSupport::Multibyte.default_normalization_form = :c
|
21
|
+
mattr_accessor :default_normalization_form
|
22
|
+
self.default_normalization_form = :kc
|
23
|
+
|
24
|
+
# The proxy class returned when calling mb_chars. You can use this accessor to configure your own proxy
|
25
|
+
# class so you can support other encodings. See the ActiveSupport::Multibyte::Chars implementation for
|
26
|
+
# an example how to do this.
|
27
|
+
#
|
28
|
+
# Example:
|
29
|
+
# ActiveSupport::Multibyte.proxy_class = CharsForUTF32
|
30
|
+
mattr_accessor :proxy_class
|
31
|
+
self.proxy_class = ActiveSupport::Multibyte::Chars
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module ActiveSupport
|
2
|
+
class OptionMerger #:nodoc:
|
3
|
+
instance_methods.each do |method|
|
4
|
+
undef_method(method) if method !~ /^(__|instance_eval|class|object_id)/
|
5
|
+
end
|
6
|
+
|
7
|
+
def initialize(context, options)
|
8
|
+
@context, @options = context, options
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
def method_missing(method, *arguments, &block)
|
13
|
+
arguments << (arguments.last.respond_to?(:to_hash) ? @options.deep_merge(arguments.pop) : @options.dup)
|
14
|
+
@context.__send__(method, *arguments, &block)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# OrderedHash is namespaced to prevent conflicts with other implementations
|
2
|
+
module ActiveSupport
|
3
|
+
# Hash is ordered in Ruby 1.9!
|
4
|
+
if RUBY_VERSION >= '1.9'
|
5
|
+
OrderedHash = ::Hash
|
6
|
+
else
|
7
|
+
class OrderedHash < Array #:nodoc:
|
8
|
+
def []=(key, value)
|
9
|
+
if pair = assoc(key)
|
10
|
+
pair.pop
|
11
|
+
pair << value
|
12
|
+
else
|
13
|
+
self << [key, value]
|
14
|
+
end
|
15
|
+
value
|
16
|
+
end
|
17
|
+
|
18
|
+
def [](key)
|
19
|
+
pair = assoc(key)
|
20
|
+
pair ? pair.last : nil
|
21
|
+
end
|
22
|
+
|
23
|
+
def delete(key)
|
24
|
+
pair = assoc(key)
|
25
|
+
pair ? array_index = index(pair) : nil
|
26
|
+
array_index ? delete_at(array_index).last : nil
|
27
|
+
end
|
28
|
+
|
29
|
+
def keys
|
30
|
+
collect { |key, value| key }
|
31
|
+
end
|
32
|
+
|
33
|
+
def values
|
34
|
+
collect { |key, value| value }
|
35
|
+
end
|
36
|
+
|
37
|
+
def to_hash
|
38
|
+
returning({}) do |hash|
|
39
|
+
each { |array| hash[array[0]] = array[1] }
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def has_key?(k)
|
44
|
+
!assoc(k).nil?
|
45
|
+
end
|
46
|
+
|
47
|
+
alias_method :key?, :has_key?
|
48
|
+
alias_method :include?, :has_key?
|
49
|
+
alias_method :member?, :has_key?
|
50
|
+
|
51
|
+
def has_value?(v)
|
52
|
+
any? { |key, value| value == v }
|
53
|
+
end
|
54
|
+
|
55
|
+
alias_method :value?, :has_value?
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module ActiveSupport #:nodoc:
|
2
|
+
class OrderedOptions < OrderedHash #:nodoc:
|
3
|
+
def []=(key, value)
|
4
|
+
super(key.to_sym, value)
|
5
|
+
end
|
6
|
+
|
7
|
+
def [](key)
|
8
|
+
super(key.to_sym)
|
9
|
+
end
|
10
|
+
|
11
|
+
def method_missing(name, *args)
|
12
|
+
if name.to_s =~ /(.*)=$/
|
13
|
+
self[$1.to_sym] = args.first
|
14
|
+
else
|
15
|
+
self[name]
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,108 @@
|
|
1
|
+
module ActiveSupport
|
2
|
+
# Rescuable module adds support for easier exception handling.
|
3
|
+
module Rescuable
|
4
|
+
def self.included(base) # :nodoc:
|
5
|
+
base.class_inheritable_accessor :rescue_handlers
|
6
|
+
base.rescue_handlers = []
|
7
|
+
|
8
|
+
base.extend(ClassMethods)
|
9
|
+
end
|
10
|
+
|
11
|
+
module ClassMethods
|
12
|
+
# Rescue exceptions raised in controller actions.
|
13
|
+
#
|
14
|
+
# <tt>rescue_from</tt> receives a series of exception classes or class
|
15
|
+
# names, and a trailing <tt>:with</tt> option with the name of a method
|
16
|
+
# or a Proc object to be called to handle them. Alternatively a block can
|
17
|
+
# be given.
|
18
|
+
#
|
19
|
+
# Handlers that take one argument will be called with the exception, so
|
20
|
+
# that the exception can be inspected when dealing with it.
|
21
|
+
#
|
22
|
+
# Handlers are inherited. They are searched from right to left, from
|
23
|
+
# bottom to top, and up the hierarchy. The handler of the first class for
|
24
|
+
# which <tt>exception.is_a?(klass)</tt> holds true is the one invoked, if
|
25
|
+
# any.
|
26
|
+
#
|
27
|
+
# class ApplicationController < ActionController::Base
|
28
|
+
# rescue_from User::NotAuthorized, :with => :deny_access # self defined exception
|
29
|
+
# rescue_from ActiveRecord::RecordInvalid, :with => :show_errors
|
30
|
+
#
|
31
|
+
# rescue_from 'MyAppError::Base' do |exception|
|
32
|
+
# render :xml => exception, :status => 500
|
33
|
+
# end
|
34
|
+
#
|
35
|
+
# protected
|
36
|
+
# def deny_access
|
37
|
+
# ...
|
38
|
+
# end
|
39
|
+
#
|
40
|
+
# def show_errors(exception)
|
41
|
+
# exception.record.new_record? ? ...
|
42
|
+
# end
|
43
|
+
# end
|
44
|
+
def rescue_from(*klasses, &block)
|
45
|
+
options = klasses.extract_options!
|
46
|
+
|
47
|
+
unless options.has_key?(:with)
|
48
|
+
if block_given?
|
49
|
+
options[:with] = block
|
50
|
+
else
|
51
|
+
raise ArgumentError, "Need a handler. Supply an options hash that has a :with key as the last argument."
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
klasses.each do |klass|
|
56
|
+
key = if klass.is_a?(Class) && klass <= Exception
|
57
|
+
klass.name
|
58
|
+
elsif klass.is_a?(String)
|
59
|
+
klass
|
60
|
+
else
|
61
|
+
raise ArgumentError, "#{klass} is neither an Exception nor a String"
|
62
|
+
end
|
63
|
+
|
64
|
+
# put the new handler at the end because the list is read in reverse
|
65
|
+
rescue_handlers << [key, options[:with]]
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
# Tries to rescue the exception by looking up and calling a registered handler.
|
71
|
+
def rescue_with_handler(exception)
|
72
|
+
if handler = handler_for_rescue(exception)
|
73
|
+
handler.arity != 0 ? handler.call(exception) : handler.call
|
74
|
+
true # don't rely on the return value of the handler
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def handler_for_rescue(exception)
|
79
|
+
# We go from right to left because pairs are pushed onto rescue_handlers
|
80
|
+
# as rescue_from declarations are found.
|
81
|
+
_, rescuer = Array(rescue_handlers).reverse.detect do |klass_name, handler|
|
82
|
+
# The purpose of allowing strings in rescue_from is to support the
|
83
|
+
# declaration of handler associations for exception classes whose
|
84
|
+
# definition is yet unknown.
|
85
|
+
#
|
86
|
+
# Since this loop needs the constants it would be inconsistent to
|
87
|
+
# assume they should exist at this point. An early raised exception
|
88
|
+
# could trigger some other handler and the array could include
|
89
|
+
# precisely a string whose corresponding constant has not yet been
|
90
|
+
# seen. This is why we are tolerant to unknown constants.
|
91
|
+
#
|
92
|
+
# Note that this tolerance only matters if the exception was given as
|
93
|
+
# a string, otherwise a NameError will be raised by the interpreter
|
94
|
+
# itself when rescue_from CONSTANT is executed.
|
95
|
+
klass = self.class.const_get(klass_name) rescue nil
|
96
|
+
klass ||= klass_name.constantize rescue nil
|
97
|
+
exception.is_a?(klass) if klass
|
98
|
+
end
|
99
|
+
|
100
|
+
case rescuer
|
101
|
+
when Symbol
|
102
|
+
method(rescuer)
|
103
|
+
when Proc
|
104
|
+
rescuer.bind(self)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
@@ -0,0 +1,197 @@
|
|
1
|
+
begin
|
2
|
+
require 'openssl'
|
3
|
+
rescue LoadError
|
4
|
+
end
|
5
|
+
|
6
|
+
begin
|
7
|
+
require 'securerandom'
|
8
|
+
rescue LoadError
|
9
|
+
end
|
10
|
+
|
11
|
+
module ActiveSupport
|
12
|
+
if defined?(::SecureRandom)
|
13
|
+
# Use Ruby 1.9's SecureRandom library whenever possible.
|
14
|
+
SecureRandom = ::SecureRandom # :nodoc:
|
15
|
+
else
|
16
|
+
# = Secure random number generator interface.
|
17
|
+
#
|
18
|
+
# This library is an interface for secure random number generator which is
|
19
|
+
# suitable for generating session key in HTTP cookies, etc.
|
20
|
+
#
|
21
|
+
# It supports following secure random number generators.
|
22
|
+
#
|
23
|
+
# * openssl
|
24
|
+
# * /dev/urandom
|
25
|
+
# * Win32
|
26
|
+
#
|
27
|
+
# *Note*: This module is based on the SecureRandom library from Ruby 1.9,
|
28
|
+
# revision 18786, August 23 2008. It's 100% interface-compatible with Ruby 1.9's
|
29
|
+
# SecureRandom library.
|
30
|
+
#
|
31
|
+
# == Example
|
32
|
+
#
|
33
|
+
# # random hexadecimal string.
|
34
|
+
# p SecureRandom.hex(10) #=> "52750b30ffbc7de3b362"
|
35
|
+
# p SecureRandom.hex(10) #=> "92b15d6c8dc4beb5f559"
|
36
|
+
# p SecureRandom.hex(11) #=> "6aca1b5c58e4863e6b81b8"
|
37
|
+
# p SecureRandom.hex(12) #=> "94b2fff3e7fd9b9c391a2306"
|
38
|
+
# p SecureRandom.hex(13) #=> "39b290146bea6ce975c37cfc23"
|
39
|
+
# ...
|
40
|
+
#
|
41
|
+
# # random base64 string.
|
42
|
+
# p SecureRandom.base64(10) #=> "EcmTPZwWRAozdA=="
|
43
|
+
# p SecureRandom.base64(10) #=> "9b0nsevdwNuM/w=="
|
44
|
+
# p SecureRandom.base64(10) #=> "KO1nIU+p9DKxGg=="
|
45
|
+
# p SecureRandom.base64(11) #=> "l7XEiFja+8EKEtY="
|
46
|
+
# p SecureRandom.base64(12) #=> "7kJSM/MzBJI+75j8"
|
47
|
+
# p SecureRandom.base64(13) #=> "vKLJ0tXBHqQOuIcSIg=="
|
48
|
+
# ...
|
49
|
+
#
|
50
|
+
# # random binary string.
|
51
|
+
# p SecureRandom.random_bytes(10) #=> "\016\t{\370g\310pbr\301"
|
52
|
+
# p SecureRandom.random_bytes(10) #=> "\323U\030TO\234\357\020\a\337"
|
53
|
+
# ...
|
54
|
+
module SecureRandom
|
55
|
+
# SecureRandom.random_bytes generates a random binary string.
|
56
|
+
#
|
57
|
+
# The argument n specifies the length of the result string.
|
58
|
+
#
|
59
|
+
# If n is not specified, 16 is assumed.
|
60
|
+
# It may be larger in future.
|
61
|
+
#
|
62
|
+
# If secure random number generator is not available,
|
63
|
+
# NotImplementedError is raised.
|
64
|
+
def self.random_bytes(n=nil)
|
65
|
+
n ||= 16
|
66
|
+
|
67
|
+
if defined? OpenSSL::Random
|
68
|
+
return OpenSSL::Random.random_bytes(n)
|
69
|
+
end
|
70
|
+
|
71
|
+
if !defined?(@has_urandom) || @has_urandom
|
72
|
+
flags = File::RDONLY
|
73
|
+
flags |= File::NONBLOCK if defined? File::NONBLOCK
|
74
|
+
flags |= File::NOCTTY if defined? File::NOCTTY
|
75
|
+
flags |= File::NOFOLLOW if defined? File::NOFOLLOW
|
76
|
+
begin
|
77
|
+
File.open("/dev/urandom", flags) {|f|
|
78
|
+
unless f.stat.chardev?
|
79
|
+
raise Errno::ENOENT
|
80
|
+
end
|
81
|
+
@has_urandom = true
|
82
|
+
ret = f.readpartial(n)
|
83
|
+
if ret.length != n
|
84
|
+
raise NotImplementedError, "Unexpected partial read from random device"
|
85
|
+
end
|
86
|
+
return ret
|
87
|
+
}
|
88
|
+
rescue Errno::ENOENT
|
89
|
+
@has_urandom = false
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
if !defined?(@has_win32)
|
94
|
+
begin
|
95
|
+
require 'Win32API'
|
96
|
+
|
97
|
+
crypt_acquire_context = Win32API.new("advapi32", "CryptAcquireContext", 'PPPII', 'L')
|
98
|
+
@crypt_gen_random = Win32API.new("advapi32", "CryptGenRandom", 'LIP', 'L')
|
99
|
+
|
100
|
+
hProvStr = " " * 4
|
101
|
+
prov_rsa_full = 1
|
102
|
+
crypt_verifycontext = 0xF0000000
|
103
|
+
|
104
|
+
if crypt_acquire_context.call(hProvStr, nil, nil, prov_rsa_full, crypt_verifycontext) == 0
|
105
|
+
raise SystemCallError, "CryptAcquireContext failed: #{lastWin32ErrorMessage}"
|
106
|
+
end
|
107
|
+
@hProv, = hProvStr.unpack('L')
|
108
|
+
|
109
|
+
@has_win32 = true
|
110
|
+
rescue LoadError
|
111
|
+
@has_win32 = false
|
112
|
+
end
|
113
|
+
end
|
114
|
+
if @has_win32
|
115
|
+
bytes = " " * n
|
116
|
+
if @crypt_gen_random.call(@hProv, bytes.size, bytes) == 0
|
117
|
+
raise SystemCallError, "CryptGenRandom failed: #{lastWin32ErrorMessage}"
|
118
|
+
end
|
119
|
+
return bytes
|
120
|
+
end
|
121
|
+
|
122
|
+
raise NotImplementedError, "No random device"
|
123
|
+
end
|
124
|
+
|
125
|
+
# SecureRandom.hex generates a random hex string.
|
126
|
+
#
|
127
|
+
# The argument n specifies the length of the random length.
|
128
|
+
# The length of the result string is twice of n.
|
129
|
+
#
|
130
|
+
# If n is not specified, 16 is assumed.
|
131
|
+
# It may be larger in future.
|
132
|
+
#
|
133
|
+
# If secure random number generator is not available,
|
134
|
+
# NotImplementedError is raised.
|
135
|
+
def self.hex(n=nil)
|
136
|
+
random_bytes(n).unpack("H*")[0]
|
137
|
+
end
|
138
|
+
|
139
|
+
# SecureRandom.base64 generates a random base64 string.
|
140
|
+
#
|
141
|
+
# The argument n specifies the length of the random length.
|
142
|
+
# The length of the result string is about 4/3 of n.
|
143
|
+
#
|
144
|
+
# If n is not specified, 16 is assumed.
|
145
|
+
# It may be larger in future.
|
146
|
+
#
|
147
|
+
# If secure random number generator is not available,
|
148
|
+
# NotImplementedError is raised.
|
149
|
+
def self.base64(n=nil)
|
150
|
+
[random_bytes(n)].pack("m*").delete("\n")
|
151
|
+
end
|
152
|
+
|
153
|
+
# SecureRandom.random_number generates a random number.
|
154
|
+
#
|
155
|
+
# If an positive integer is given as n,
|
156
|
+
# SecureRandom.random_number returns an integer:
|
157
|
+
# 0 <= SecureRandom.random_number(n) < n.
|
158
|
+
#
|
159
|
+
# If 0 is given or an argument is not given,
|
160
|
+
# SecureRandom.random_number returns an float:
|
161
|
+
# 0.0 <= SecureRandom.random_number() < 1.0.
|
162
|
+
def self.random_number(n=0)
|
163
|
+
if 0 < n
|
164
|
+
hex = n.to_s(16)
|
165
|
+
hex = '0' + hex if (hex.length & 1) == 1
|
166
|
+
bin = [hex].pack("H*")
|
167
|
+
mask = bin[0]
|
168
|
+
mask |= mask >> 1
|
169
|
+
mask |= mask >> 2
|
170
|
+
mask |= mask >> 4
|
171
|
+
begin
|
172
|
+
rnd = SecureRandom.random_bytes(bin.length)
|
173
|
+
rnd[0] = rnd[0] & mask
|
174
|
+
end until rnd < bin
|
175
|
+
rnd.unpack("H*")[0].hex
|
176
|
+
else
|
177
|
+
# assumption: Float::MANT_DIG <= 64
|
178
|
+
i64 = SecureRandom.random_bytes(8).unpack("Q")[0]
|
179
|
+
Math.ldexp(i64 >> (64-Float::MANT_DIG), -Float::MANT_DIG)
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
# Following code is based on David Garamond's GUID library for Ruby.
|
184
|
+
def self.lastWin32ErrorMessage # :nodoc:
|
185
|
+
get_last_error = Win32API.new("kernel32", "GetLastError", '', 'L')
|
186
|
+
format_message = Win32API.new("kernel32", "FormatMessageA", 'LPLLPLPPPPPPPP', 'L')
|
187
|
+
format_message_ignore_inserts = 0x00000200
|
188
|
+
format_message_from_system = 0x00001000
|
189
|
+
|
190
|
+
code = get_last_error.call
|
191
|
+
msg = "\0" * 1024
|
192
|
+
len = format_message.call(format_message_ignore_inserts + format_message_from_system, 0, code, 0, msg, 1024, nil, nil, nil, nil, nil, nil, nil, nil)
|
193
|
+
msg[0, len].tr("\r", '').chomp
|
194
|
+
end
|
195
|
+
end
|
196
|
+
end
|
197
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module ActiveSupport
|
2
|
+
# Wrapping a string in this class gives you a prettier way to test
|
3
|
+
# for equality. The value returned by <tt>Rails.env</tt> is wrapped
|
4
|
+
# in a StringInquirer object so instead of calling this:
|
5
|
+
#
|
6
|
+
# Rails.env == "production"
|
7
|
+
#
|
8
|
+
# you can call this:
|
9
|
+
#
|
10
|
+
# Rails.env.production?
|
11
|
+
#
|
12
|
+
class StringInquirer < String
|
13
|
+
def method_missing(method_name, *arguments)
|
14
|
+
if method_name.to_s[-1,1] == "?"
|
15
|
+
self == method_name.to_s[0..-2]
|
16
|
+
else
|
17
|
+
super
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'test/unit/testcase'
|
2
|
+
require 'active_support/testing/default'
|
3
|
+
require 'active_support/testing/core_ext/test'
|
4
|
+
|
5
|
+
|
6
|
+
module ActiveSupport
|
7
|
+
class TestCase < Test::Unit::TestCase
|
8
|
+
# test "verify something" do
|
9
|
+
# ...
|
10
|
+
# end
|
11
|
+
def self.test(name, &block)
|
12
|
+
test_name = "test_#{name.gsub(/\s+/,'_')}".to_sym
|
13
|
+
defined = instance_method(test_name) rescue false
|
14
|
+
raise "#{test_name} is already defined in #{self}" if defined
|
15
|
+
if block_given?
|
16
|
+
define_method(test_name, &block)
|
17
|
+
else
|
18
|
+
define_method(test_name) do
|
19
|
+
flunk "No implementation provided for #{name}"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
require 'test/unit/assertions'
|
2
|
+
module Test
|
3
|
+
module Unit
|
4
|
+
#--
|
5
|
+
# FIXME: no Proc#binding in Ruby 2, must change this API
|
6
|
+
#++
|
7
|
+
module Assertions
|
8
|
+
# Test numeric difference between the return value of an expression as a result of what is evaluated
|
9
|
+
# in the yielded block.
|
10
|
+
#
|
11
|
+
# assert_difference 'Article.count' do
|
12
|
+
# post :create, :article => {...}
|
13
|
+
# end
|
14
|
+
#
|
15
|
+
# An arbitrary expression is passed in and evaluated.
|
16
|
+
#
|
17
|
+
# assert_difference 'assigns(:article).comments(:reload).size' do
|
18
|
+
# post :create, :comment => {...}
|
19
|
+
# end
|
20
|
+
#
|
21
|
+
# An arbitrary positive or negative difference can be specified. The default is +1.
|
22
|
+
#
|
23
|
+
# assert_difference 'Article.count', -1 do
|
24
|
+
# post :delete, :id => ...
|
25
|
+
# end
|
26
|
+
#
|
27
|
+
# An array of expressions can also be passed in and evaluated.
|
28
|
+
#
|
29
|
+
# assert_difference [ 'Article.count', 'Post.count' ], +2 do
|
30
|
+
# post :create, :article => {...}
|
31
|
+
# end
|
32
|
+
#
|
33
|
+
# A error message can be specified.
|
34
|
+
#
|
35
|
+
# assert_difference 'Article.count', -1, "An Article should be destroyed" do
|
36
|
+
# post :delete, :id => ...
|
37
|
+
# end
|
38
|
+
def assert_difference(expressions, difference = 1, message = nil, &block)
|
39
|
+
expression_evaluations = Array(expressions).map do |expression|
|
40
|
+
[expression, lambda do
|
41
|
+
eval(expression, block.__send__(:binding))
|
42
|
+
end]
|
43
|
+
end
|
44
|
+
|
45
|
+
original_values = expression_evaluations.inject([]) { |memo, expression| memo << expression[1].call }
|
46
|
+
yield
|
47
|
+
expression_evaluations.each_with_index do |expression, i|
|
48
|
+
full_message = ""
|
49
|
+
full_message << "#{message}.\n" if message
|
50
|
+
full_message << "<#{expression[0]}> was the expression that failed"
|
51
|
+
assert_equal original_values[i] + difference, expression[1].call, full_message
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
# Assertion that the numeric result of evaluating an expression is not changed before and after
|
56
|
+
# invoking the passed in block.
|
57
|
+
#
|
58
|
+
# assert_no_difference 'Article.count' do
|
59
|
+
# post :create, :article => invalid_attributes
|
60
|
+
# end
|
61
|
+
#
|
62
|
+
# A error message can be specified.
|
63
|
+
#
|
64
|
+
# assert_no_difference 'Article.count', "An Article should not be destroyed" do
|
65
|
+
# post :create, :article => invalid_attributes
|
66
|
+
# end
|
67
|
+
def assert_no_difference(expressions, message = nil, &block)
|
68
|
+
assert_difference expressions, 0, message, &block
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|