backbone-deep-rails 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/lib/backbone/deep/rails/version.rb +1 -1
- metadata +18 -245
- data/vendor/bundle/cache/activemodel-3.2.11.gem +0 -0
- data/vendor/bundle/cache/activesupport-3.2.11.gem +0 -0
- data/vendor/bundle/gems/activesupport-3.2.11/CHANGELOG.md +0 -157
- data/vendor/bundle/gems/activesupport-3.2.11/MIT-LICENSE +0 -20
- data/vendor/bundle/gems/activesupport-3.2.11/README.rdoc +0 -33
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support.rb +0 -82
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/all.rb +0 -3
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/backtrace_cleaner.rb +0 -99
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/base64.rb +0 -54
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/basic_object.rb +0 -21
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/benchmarkable.rb +0 -55
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/buffered_logger.rb +0 -125
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/builder.rb +0 -6
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/cache.rb +0 -638
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/cache/file_store.rb +0 -178
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/cache/mem_cache_store.rb +0 -206
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/cache/memory_store.rb +0 -159
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/cache/null_store.rb +0 -44
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/cache/strategy/local_cache.rb +0 -169
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/callbacks.rb +0 -626
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/concern.rb +0 -131
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/configurable.rb +0 -90
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext.rb +0 -3
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/array.rb +0 -8
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/array/access.rb +0 -46
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/array/conversions.rb +0 -164
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/array/extract_options.rb +0 -29
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/array/grouping.rb +0 -100
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/array/prepend_and_append.rb +0 -7
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/array/random_access.rb +0 -30
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/array/uniq_by.rb +0 -16
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/array/wrap.rb +0 -48
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/benchmark.rb +0 -7
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/big_decimal.rb +0 -1
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/big_decimal/conversions.rb +0 -45
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/class.rb +0 -4
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/class/attribute.rb +0 -115
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/class/attribute_accessors.rb +0 -168
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/class/delegating_attributes.rb +0 -44
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/class/subclasses.rb +0 -36
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/date/acts_like.rb +0 -8
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/date/calculations.rb +0 -276
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/date/conversions.rb +0 -106
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/date/freeze.rb +0 -33
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/date/zones.rb +0 -14
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/date_time/acts_like.rb +0 -13
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/date_time/calculations.rb +0 -143
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/date_time/conversions.rb +0 -103
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/date_time/zones.rb +0 -21
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/enumerable.rb +0 -127
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/exception.rb +0 -3
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/file.rb +0 -2
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/file/atomic.rb +0 -42
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/file/path.rb +0 -5
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/float.rb +0 -1
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/float/rounding.rb +0 -19
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/hash.rb +0 -9
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/hash/conversions.rb +0 -175
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/hash/deep_dup.rb +0 -18
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/hash/deep_merge.rb +0 -21
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/hash/diff.rb +0 -13
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/hash/except.rb +0 -23
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/hash/indifferent_access.rb +0 -24
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/hash/keys.rb +0 -54
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/hash/reverse_merge.rb +0 -23
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/hash/slice.rb +0 -40
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/integer.rb +0 -3
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/integer/inflections.rb +0 -17
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/integer/multiple.rb +0 -10
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/integer/time.rb +0 -39
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/io.rb +0 -15
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/kernel.rb +0 -4
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/kernel/agnostics.rb +0 -11
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/kernel/debugger.rb +0 -10
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/kernel/reporting.rb +0 -93
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/kernel/singleton_class.rb +0 -13
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/load_error.rb +0 -23
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/logger.rb +0 -83
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/module.rb +0 -12
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/module/aliasing.rb +0 -70
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/module/anonymous.rb +0 -24
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/module/attr_internal.rb +0 -39
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/module/attribute_accessors.rb +0 -64
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/module/delegation.rb +0 -153
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/module/deprecation.rb +0 -9
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/module/introspection.rb +0 -88
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/module/method_names.rb +0 -14
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/module/qualified_const.rb +0 -64
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/module/reachable.rb +0 -8
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/module/remove_method.rb +0 -16
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/module/synchronization.rb +0 -45
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/name_error.rb +0 -18
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/numeric.rb +0 -2
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/numeric/bytes.rb +0 -44
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/numeric/time.rb +0 -79
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/object.rb +0 -13
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/object/acts_like.rb +0 -10
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/object/blank.rb +0 -121
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/object/conversions.rb +0 -4
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/object/duplicable.rb +0 -119
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/object/inclusion.rb +0 -25
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/object/instance_variables.rb +0 -33
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/object/to_json.rb +0 -19
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/object/to_param.rb +0 -55
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/object/to_query.rb +0 -27
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/object/try.rb +0 -57
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/object/with_options.rb +0 -43
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/proc.rb +0 -14
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/process.rb +0 -1
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/process/daemon.rb +0 -23
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/range.rb +0 -5
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/range/blockless_step.rb +0 -29
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/range/conversions.rb +0 -21
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/range/cover.rb +0 -3
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/range/include_range.rb +0 -21
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/range/overlaps.rb +0 -8
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/regexp.rb +0 -5
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/rexml.rb +0 -46
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string.rb +0 -14
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string/access.rb +0 -99
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string/behavior.rb +0 -6
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string/conversions.rb +0 -66
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string/encoding.rb +0 -11
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string/exclude.rb +0 -11
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string/filters.rb +0 -49
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string/inflections.rb +0 -202
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string/inquiry.rb +0 -13
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string/interpolation.rb +0 -2
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string/multibyte.rb +0 -72
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string/output_safety.rb +0 -186
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string/starts_ends_with.rb +0 -4
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string/strip.rb +0 -26
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string/xchar.rb +0 -18
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/time/acts_like.rb +0 -8
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/time/calculations.rb +0 -360
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/time/conversions.rb +0 -85
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/time/marshal.rb +0 -57
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/time/publicize_conversion_methods.rb +0 -10
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/time/zones.rb +0 -86
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/uri.rb +0 -30
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/dependencies.rb +0 -703
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/dependencies/autoload.rb +0 -50
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/deprecation.rb +0 -18
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/deprecation/behaviors.rb +0 -49
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/deprecation/method_wrappers.rb +0 -29
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/deprecation/proxy_wrappers.rb +0 -81
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/deprecation/reporting.rb +0 -65
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/descendants_tracker.rb +0 -45
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/duration.rb +0 -110
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/file_update_checker.rb +0 -121
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/file_watcher.rb +0 -36
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/gzip.rb +0 -30
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/hash_with_indifferent_access.rb +0 -178
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/i18n.rb +0 -9
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/i18n_railtie.rb +0 -102
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/inflections.rb +0 -63
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/inflector.rb +0 -7
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/inflector/inflections.rb +0 -174
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/inflector/methods.rb +0 -321
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/inflector/transliterate.rb +0 -98
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/json.rb +0 -2
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/json/decoding.rb +0 -79
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/json/encoding.rb +0 -284
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/json/variable.rb +0 -9
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/lazy_load_hooks.rb +0 -46
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/locale/en.yml +0 -36
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/log_subscriber.rb +0 -122
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/log_subscriber/test_helper.rb +0 -101
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/memoizable.rb +0 -116
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/message_encryptor.rb +0 -103
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/message_verifier.rb +0 -74
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/multibyte.rb +0 -44
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/multibyte/chars.rb +0 -476
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/multibyte/exceptions.rb +0 -8
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/multibyte/unicode.rb +0 -393
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/multibyte/utils.rb +0 -60
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/notifications.rb +0 -154
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/notifications/fanout.rb +0 -61
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/notifications/instrumenter.rb +0 -53
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/option_merger.rb +0 -25
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/ordered_hash.rb +0 -222
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/ordered_options.rb +0 -61
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/railtie.rb +0 -59
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/rescuable.rb +0 -115
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/ruby/shim.rb +0 -22
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/string_inquirer.rb +0 -21
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/tagged_logging.rb +0 -80
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/test_case.rb +0 -34
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/testing/assertions.rb +0 -97
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/testing/declarative.rb +0 -40
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/testing/deprecation.rb +0 -55
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/testing/isolation.rb +0 -157
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/testing/mochaing.rb +0 -7
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/testing/pending.rb +0 -52
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/testing/performance.rb +0 -317
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/testing/performance/jruby.rb +0 -115
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/testing/performance/rubinius.rb +0 -113
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/testing/performance/ruby.rb +0 -152
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/testing/performance/ruby/mri.rb +0 -57
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/testing/performance/ruby/yarv.rb +0 -57
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/testing/setup_and_teardown.rb +0 -118
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/time.rb +0 -35
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/time/autoload.rb +0 -5
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/time_with_zone.rb +0 -358
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/values/time_zone.rb +0 -397
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/values/unicode_tables.dat +0 -0
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/version.rb +0 -10
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/whiny_nil.rb +0 -24
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/xml_mini.rb +0 -168
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/xml_mini/jdom.rb +0 -175
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/xml_mini/libxml.rb +0 -80
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/xml_mini/libxmlsax.rb +0 -86
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/xml_mini/nokogiri.rb +0 -84
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/xml_mini/nokogirisax.rb +0 -88
- data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/xml_mini/rexml.rb +0 -130
- data/vendor/bundle/specifications/activesupport-3.2.11.gemspec +0 -33
data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/array/extract_options.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
class Hash
|
2
|
-
# By default, only instances of Hash itself are extractable.
|
3
|
-
# Subclasses of Hash may implement this method and return
|
4
|
-
# true to declare themselves as extractable. If a Hash
|
5
|
-
# is extractable, Array#extract_options! pops it from
|
6
|
-
# the Array when it is the last element of the Array.
|
7
|
-
def extractable_options?
|
8
|
-
instance_of?(Hash)
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
class Array
|
13
|
-
# Extracts options from a set of arguments. Removes and returns the last
|
14
|
-
# element in the array if it's a hash, otherwise returns a blank hash.
|
15
|
-
#
|
16
|
-
# def options(*args)
|
17
|
-
# args.extract_options!
|
18
|
-
# end
|
19
|
-
#
|
20
|
-
# options(1, 2) # => {}
|
21
|
-
# options(1, 2, :a => :b) # => {:a=>:b}
|
22
|
-
def extract_options!
|
23
|
-
if last.is_a?(Hash) && last.extractable_options?
|
24
|
-
pop
|
25
|
-
else
|
26
|
-
{}
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
@@ -1,100 +0,0 @@
|
|
1
|
-
require 'enumerator'
|
2
|
-
|
3
|
-
class Array
|
4
|
-
# Splits or iterates over the array in groups of size +number+,
|
5
|
-
# padding any remaining slots with +fill_with+ unless it is +false+.
|
6
|
-
#
|
7
|
-
# %w(1 2 3 4 5 6 7).in_groups_of(3) {|group| p group}
|
8
|
-
# ["1", "2", "3"]
|
9
|
-
# ["4", "5", "6"]
|
10
|
-
# ["7", nil, nil]
|
11
|
-
#
|
12
|
-
# %w(1 2 3).in_groups_of(2, ' ') {|group| p group}
|
13
|
-
# ["1", "2"]
|
14
|
-
# ["3", " "]
|
15
|
-
#
|
16
|
-
# %w(1 2 3).in_groups_of(2, false) {|group| p group}
|
17
|
-
# ["1", "2"]
|
18
|
-
# ["3"]
|
19
|
-
def in_groups_of(number, fill_with = nil)
|
20
|
-
if fill_with == false
|
21
|
-
collection = self
|
22
|
-
else
|
23
|
-
# size % number gives how many extra we have;
|
24
|
-
# subtracting from number gives how many to add;
|
25
|
-
# modulo number ensures we don't add group of just fill.
|
26
|
-
padding = (number - size % number) % number
|
27
|
-
collection = dup.concat([fill_with] * padding)
|
28
|
-
end
|
29
|
-
|
30
|
-
if block_given?
|
31
|
-
collection.each_slice(number) { |slice| yield(slice) }
|
32
|
-
else
|
33
|
-
groups = []
|
34
|
-
collection.each_slice(number) { |group| groups << group }
|
35
|
-
groups
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
# Splits or iterates over the array in +number+ of groups, padding any
|
40
|
-
# remaining slots with +fill_with+ unless it is +false+.
|
41
|
-
#
|
42
|
-
# %w(1 2 3 4 5 6 7 8 9 10).in_groups(3) {|group| p group}
|
43
|
-
# ["1", "2", "3", "4"]
|
44
|
-
# ["5", "6", "7", nil]
|
45
|
-
# ["8", "9", "10", nil]
|
46
|
-
#
|
47
|
-
# %w(1 2 3 4 5 6 7).in_groups(3, ' ') {|group| p group}
|
48
|
-
# ["1", "2", "3"]
|
49
|
-
# ["4", "5", " "]
|
50
|
-
# ["6", "7", " "]
|
51
|
-
#
|
52
|
-
# %w(1 2 3 4 5 6 7).in_groups(3, false) {|group| p group}
|
53
|
-
# ["1", "2", "3"]
|
54
|
-
# ["4", "5"]
|
55
|
-
# ["6", "7"]
|
56
|
-
def in_groups(number, fill_with = nil)
|
57
|
-
# size / number gives minor group size;
|
58
|
-
# size % number gives how many objects need extra accommodation;
|
59
|
-
# each group hold either division or division + 1 items.
|
60
|
-
division = size / number
|
61
|
-
modulo = size % number
|
62
|
-
|
63
|
-
# create a new array avoiding dup
|
64
|
-
groups = []
|
65
|
-
start = 0
|
66
|
-
|
67
|
-
number.times do |index|
|
68
|
-
length = division + (modulo > 0 && modulo > index ? 1 : 0)
|
69
|
-
padding = fill_with != false &&
|
70
|
-
modulo > 0 && length == division ? 1 : 0
|
71
|
-
groups << slice(start, length).concat([fill_with] * padding)
|
72
|
-
start += length
|
73
|
-
end
|
74
|
-
|
75
|
-
if block_given?
|
76
|
-
groups.each { |g| yield(g) }
|
77
|
-
else
|
78
|
-
groups
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
# Divides the array into one or more subarrays based on a delimiting +value+
|
83
|
-
# or the result of an optional block.
|
84
|
-
#
|
85
|
-
# [1, 2, 3, 4, 5].split(3) # => [[1, 2], [4, 5]]
|
86
|
-
# (1..10).to_a.split { |i| i % 3 == 0 } # => [[1, 2], [4, 5], [7, 8], [10]]
|
87
|
-
def split(value = nil)
|
88
|
-
using_block = block_given?
|
89
|
-
|
90
|
-
inject([[]]) do |results, element|
|
91
|
-
if (using_block && yield(element)) || (value == element)
|
92
|
-
results << []
|
93
|
-
else
|
94
|
-
results.last << element
|
95
|
-
end
|
96
|
-
|
97
|
-
results
|
98
|
-
end
|
99
|
-
end
|
100
|
-
end
|
data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/array/random_access.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
class Array
|
2
|
-
# Backport of Array#sample based on Marc-Andre Lafortune's https://github.com/marcandre/backports/
|
3
|
-
# Returns a random element or +n+ random elements from the array.
|
4
|
-
# If the array is empty and +n+ is nil, returns <tt>nil</tt>.
|
5
|
-
# If +n+ is passed and its value is less than 0, it raises an +ArgumentError+ exception.
|
6
|
-
# If the value of +n+ is equal or greater than 0 it returns <tt>[]</tt>.
|
7
|
-
#
|
8
|
-
# [1,2,3,4,5,6].sample # => 4
|
9
|
-
# [1,2,3,4,5,6].sample(3) # => [2, 4, 5]
|
10
|
-
# [1,2,3,4,5,6].sample(-3) # => ArgumentError: negative array size
|
11
|
-
# [].sample # => nil
|
12
|
-
# [].sample(3) # => []
|
13
|
-
def sample(n=nil)
|
14
|
-
return self[Kernel.rand(size)] if n.nil?
|
15
|
-
n = n.to_int
|
16
|
-
rescue Exception => e
|
17
|
-
raise TypeError, "Coercion error: #{n.inspect}.to_int => Integer failed:\n(#{e.message})"
|
18
|
-
else
|
19
|
-
raise TypeError, "Coercion error: obj.to_int did NOT return an Integer (was #{n.class})" unless n.kind_of? Integer
|
20
|
-
raise ArgumentError, "negative array size" if n < 0
|
21
|
-
n = size if n > size
|
22
|
-
result = Array.new(self)
|
23
|
-
n.times do |i|
|
24
|
-
r = i + Kernel.rand(size - i)
|
25
|
-
result[i], result[r] = result[r], result[i]
|
26
|
-
end
|
27
|
-
result[n..size] = []
|
28
|
-
result
|
29
|
-
end unless method_defined? :sample
|
30
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
class Array
|
2
|
-
# Returns an unique array based on the criteria given as a +Proc+.
|
3
|
-
#
|
4
|
-
# [1, 2, 3, 4].uniq_by { |i| i.odd? } # => [1, 2]
|
5
|
-
#
|
6
|
-
def uniq_by
|
7
|
-
hash, array = {}, []
|
8
|
-
each { |i| hash[yield(i)] ||= (array << i) }
|
9
|
-
array
|
10
|
-
end
|
11
|
-
|
12
|
-
# Same as uniq_by, but modifies self.
|
13
|
-
def uniq_by!
|
14
|
-
replace(uniq_by{ |i| yield(i) })
|
15
|
-
end
|
16
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
class Array
|
2
|
-
# Wraps its argument in an array unless it is already an array (or array-like).
|
3
|
-
#
|
4
|
-
# Specifically:
|
5
|
-
#
|
6
|
-
# * If the argument is +nil+ an empty list is returned.
|
7
|
-
# * Otherwise, if the argument responds to +to_ary+ it is invoked, and its result returned.
|
8
|
-
# * Otherwise, returns an array with the argument as its single element.
|
9
|
-
#
|
10
|
-
# Array.wrap(nil) # => []
|
11
|
-
# Array.wrap([1, 2, 3]) # => [1, 2, 3]
|
12
|
-
# Array.wrap(0) # => [0]
|
13
|
-
#
|
14
|
-
# This method is similar in purpose to <tt>Kernel#Array</tt>, but there are some differences:
|
15
|
-
#
|
16
|
-
# * If the argument responds to +to_ary+ the method is invoked. <tt>Kernel#Array</tt>
|
17
|
-
# moves on to try +to_a+ if the returned value is +nil+, but <tt>Array.wrap</tt> returns
|
18
|
-
# such a +nil+ right away.
|
19
|
-
# * If the returned value from +to_ary+ is neither +nil+ nor an +Array+ object, <tt>Kernel#Array</tt>
|
20
|
-
# raises an exception, while <tt>Array.wrap</tt> does not, it just returns the value.
|
21
|
-
# * It does not call +to_a+ on the argument, though special-cases +nil+ to return an empty array.
|
22
|
-
#
|
23
|
-
# The last point is particularly worth comparing for some enumerables:
|
24
|
-
#
|
25
|
-
# Array(:foo => :bar) # => [[:foo, :bar]]
|
26
|
-
# Array.wrap(:foo => :bar) # => [{:foo => :bar}]
|
27
|
-
#
|
28
|
-
# Array("foo\nbar") # => ["foo\n", "bar"], in Ruby 1.8
|
29
|
-
# Array.wrap("foo\nbar") # => ["foo\nbar"]
|
30
|
-
#
|
31
|
-
# There's also a related idiom that uses the splat operator:
|
32
|
-
#
|
33
|
-
# [*object]
|
34
|
-
#
|
35
|
-
# which returns <tt>[nil]</tt> for +nil+, and calls to <tt>Array(object)</tt> otherwise.
|
36
|
-
#
|
37
|
-
# Thus, in this case the behavior is different for +nil+, and the differences with
|
38
|
-
# <tt>Kernel#Array</tt> explained above apply to the rest of +object+s.
|
39
|
-
def self.wrap(object)
|
40
|
-
if object.nil?
|
41
|
-
[]
|
42
|
-
elsif object.respond_to?(:to_ary)
|
43
|
-
object.to_ary || [object]
|
44
|
-
else
|
45
|
-
[object]
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
require 'active_support/core_ext/big_decimal/conversions'
|
data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/big_decimal/conversions.rb
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
require 'bigdecimal'
|
2
|
-
|
3
|
-
begin
|
4
|
-
require 'psych'
|
5
|
-
rescue LoadError
|
6
|
-
end
|
7
|
-
|
8
|
-
require 'yaml'
|
9
|
-
|
10
|
-
class BigDecimal
|
11
|
-
YAML_TAG = 'tag:yaml.org,2002:float'
|
12
|
-
YAML_MAPPING = { 'Infinity' => '.Inf', '-Infinity' => '-.Inf', 'NaN' => '.NaN' }
|
13
|
-
|
14
|
-
# This emits the number without any scientific notation.
|
15
|
-
# This is better than self.to_f.to_s since it doesn't lose precision.
|
16
|
-
#
|
17
|
-
# Note that reconstituting YAML floats to native floats may lose precision.
|
18
|
-
def to_yaml(opts = {})
|
19
|
-
return super if defined?(YAML::ENGINE) && !YAML::ENGINE.syck?
|
20
|
-
|
21
|
-
YAML.quick_emit(nil, opts) do |out|
|
22
|
-
string = to_s
|
23
|
-
out.scalar(YAML_TAG, YAML_MAPPING[string] || string, :plain)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
def encode_with(coder)
|
28
|
-
string = to_s
|
29
|
-
coder.represent_scalar(nil, YAML_MAPPING[string] || string)
|
30
|
-
end
|
31
|
-
|
32
|
-
# Backport this method if it doesn't exist
|
33
|
-
unless method_defined?(:to_d)
|
34
|
-
def to_d
|
35
|
-
self
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
DEFAULT_STRING_FORMAT = 'F'
|
40
|
-
def to_formatted_s(format = DEFAULT_STRING_FORMAT)
|
41
|
-
_original_to_s(format)
|
42
|
-
end
|
43
|
-
alias_method :_original_to_s, :to_s
|
44
|
-
alias_method :to_s, :to_formatted_s
|
45
|
-
end
|
@@ -1,115 +0,0 @@
|
|
1
|
-
require 'active_support/core_ext/kernel/singleton_class'
|
2
|
-
require 'active_support/core_ext/module/remove_method'
|
3
|
-
require 'active_support/core_ext/array/extract_options'
|
4
|
-
|
5
|
-
class Class
|
6
|
-
# Declare a class-level attribute whose value is inheritable by subclasses.
|
7
|
-
# Subclasses can change their own value and it will not impact parent class.
|
8
|
-
#
|
9
|
-
# class Base
|
10
|
-
# class_attribute :setting
|
11
|
-
# end
|
12
|
-
#
|
13
|
-
# class Subclass < Base
|
14
|
-
# end
|
15
|
-
#
|
16
|
-
# Base.setting = true
|
17
|
-
# Subclass.setting # => true
|
18
|
-
# Subclass.setting = false
|
19
|
-
# Subclass.setting # => false
|
20
|
-
# Base.setting # => true
|
21
|
-
#
|
22
|
-
# In the above case as long as Subclass does not assign a value to setting
|
23
|
-
# by performing <tt>Subclass.setting = _something_ </tt>, <tt>Subclass.setting</tt>
|
24
|
-
# would read value assigned to parent class. Once Subclass assigns a value then
|
25
|
-
# the value assigned by Subclass would be returned.
|
26
|
-
#
|
27
|
-
# This matches normal Ruby method inheritance: think of writing an attribute
|
28
|
-
# on a subclass as overriding the reader method. However, you need to be aware
|
29
|
-
# when using +class_attribute+ with mutable structures as +Array+ or +Hash+.
|
30
|
-
# In such cases, you don't want to do changes in places but use setters:
|
31
|
-
#
|
32
|
-
# Base.setting = []
|
33
|
-
# Base.setting # => []
|
34
|
-
# Subclass.setting # => []
|
35
|
-
#
|
36
|
-
# # Appending in child changes both parent and child because it is the same object:
|
37
|
-
# Subclass.setting << :foo
|
38
|
-
# Base.setting # => [:foo]
|
39
|
-
# Subclass.setting # => [:foo]
|
40
|
-
#
|
41
|
-
# # Use setters to not propagate changes:
|
42
|
-
# Base.setting = []
|
43
|
-
# Subclass.setting += [:foo]
|
44
|
-
# Base.setting # => []
|
45
|
-
# Subclass.setting # => [:foo]
|
46
|
-
#
|
47
|
-
# For convenience, a query method is defined as well:
|
48
|
-
#
|
49
|
-
# Subclass.setting? # => false
|
50
|
-
#
|
51
|
-
# Instances may overwrite the class value in the same way:
|
52
|
-
#
|
53
|
-
# Base.setting = true
|
54
|
-
# object = Base.new
|
55
|
-
# object.setting # => true
|
56
|
-
# object.setting = false
|
57
|
-
# object.setting # => false
|
58
|
-
# Base.setting # => true
|
59
|
-
#
|
60
|
-
# To opt out of the instance reader method, pass :instance_reader => false.
|
61
|
-
#
|
62
|
-
# object.setting # => NoMethodError
|
63
|
-
# object.setting? # => NoMethodError
|
64
|
-
#
|
65
|
-
# To opt out of the instance writer method, pass :instance_writer => false.
|
66
|
-
#
|
67
|
-
# object.setting = false # => NoMethodError
|
68
|
-
def class_attribute(*attrs)
|
69
|
-
options = attrs.extract_options!
|
70
|
-
instance_reader = options.fetch(:instance_reader, true)
|
71
|
-
instance_writer = options.fetch(:instance_writer, true)
|
72
|
-
|
73
|
-
attrs.each do |name|
|
74
|
-
class_eval <<-RUBY, __FILE__, __LINE__ + 1
|
75
|
-
def self.#{name}() nil end
|
76
|
-
def self.#{name}?() !!#{name} end
|
77
|
-
|
78
|
-
def self.#{name}=(val)
|
79
|
-
singleton_class.class_eval do
|
80
|
-
remove_possible_method(:#{name})
|
81
|
-
define_method(:#{name}) { val }
|
82
|
-
end
|
83
|
-
|
84
|
-
if singleton_class?
|
85
|
-
class_eval do
|
86
|
-
remove_possible_method(:#{name})
|
87
|
-
def #{name}
|
88
|
-
defined?(@#{name}) ? @#{name} : singleton_class.#{name}
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
92
|
-
val
|
93
|
-
end
|
94
|
-
|
95
|
-
if instance_reader
|
96
|
-
remove_possible_method :#{name}
|
97
|
-
def #{name}
|
98
|
-
defined?(@#{name}) ? @#{name} : self.class.#{name}
|
99
|
-
end
|
100
|
-
|
101
|
-
def #{name}?
|
102
|
-
!!#{name}
|
103
|
-
end
|
104
|
-
end
|
105
|
-
RUBY
|
106
|
-
|
107
|
-
attr_writer name if instance_writer
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
private
|
112
|
-
def singleton_class?
|
113
|
-
ancestors.first != self
|
114
|
-
end
|
115
|
-
end
|
@@ -1,168 +0,0 @@
|
|
1
|
-
require 'active_support/core_ext/array/extract_options'
|
2
|
-
|
3
|
-
# Extends the class object with class and instance accessors for class attributes,
|
4
|
-
# just like the native attr* accessors for instance attributes.
|
5
|
-
class Class
|
6
|
-
# Defines a class attribute if it's not defined and creates a reader method that
|
7
|
-
# returns the attribute value.
|
8
|
-
#
|
9
|
-
# class Person
|
10
|
-
# cattr_reader :hair_colors
|
11
|
-
# end
|
12
|
-
#
|
13
|
-
# Person.class_variable_set("@@hair_colors", [:brown, :black])
|
14
|
-
# Person.hair_colors # => [:brown, :black]
|
15
|
-
# Person.new.hair_colors # => [:brown, :black]
|
16
|
-
#
|
17
|
-
# The attribute name must be a valid method name in Ruby.
|
18
|
-
#
|
19
|
-
# class Person
|
20
|
-
# cattr_reader :"1_Badname "
|
21
|
-
# end
|
22
|
-
# # => NameError: invalid attribute name
|
23
|
-
#
|
24
|
-
# If you want to opt out the instance reader method, you can pass <tt>:instance_reader => false</tt>
|
25
|
-
# or <tt>:instance_accessor => false</tt>.
|
26
|
-
#
|
27
|
-
# class Person
|
28
|
-
# cattr_reader :hair_colors, :instance_reader => false
|
29
|
-
# end
|
30
|
-
#
|
31
|
-
# Person.new.hair_colors # => NoMethodError
|
32
|
-
def cattr_reader(*syms)
|
33
|
-
options = syms.extract_options!
|
34
|
-
syms.each do |sym|
|
35
|
-
class_eval(<<-EOS, __FILE__, __LINE__ + 1)
|
36
|
-
unless defined? @@#{sym}
|
37
|
-
@@#{sym} = nil
|
38
|
-
end
|
39
|
-
|
40
|
-
def self.#{sym}
|
41
|
-
@@#{sym}
|
42
|
-
end
|
43
|
-
EOS
|
44
|
-
|
45
|
-
unless options[:instance_reader] == false || options[:instance_accessor] == false
|
46
|
-
class_eval(<<-EOS, __FILE__, __LINE__ + 1)
|
47
|
-
def #{sym}
|
48
|
-
@@#{sym}
|
49
|
-
end
|
50
|
-
EOS
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
# Defines a class attribute if it's not defined and creates a writer method to allow
|
56
|
-
# assignment to the attribute.
|
57
|
-
#
|
58
|
-
# class Person
|
59
|
-
# cattr_writer :hair_colors
|
60
|
-
# end
|
61
|
-
#
|
62
|
-
# Person.hair_colors = [:brown, :black]
|
63
|
-
# Person.class_variable_get("@@hair_colors") # => [:brown, :black]
|
64
|
-
# Person.new.hair_colors = [:blonde, :red]
|
65
|
-
# Person.class_variable_get("@@hair_colors") # => [:blonde, :red]
|
66
|
-
#
|
67
|
-
# The attribute name must be a valid method name in Ruby.
|
68
|
-
#
|
69
|
-
# class Person
|
70
|
-
# cattr_writer :"1_Badname "
|
71
|
-
# end
|
72
|
-
# # => NameError: invalid attribute name
|
73
|
-
#
|
74
|
-
# If you want to opt out the instance writer method, pass <tt>:instance_writer => false</tt>
|
75
|
-
# or <tt>:instance_accessor => false</tt>.
|
76
|
-
#
|
77
|
-
# class Person
|
78
|
-
# cattr_writer :hair_colors, :instance_writer => false
|
79
|
-
# end
|
80
|
-
#
|
81
|
-
# Person.new.hair_colors = [:blonde, :red] # => NoMethodError
|
82
|
-
#
|
83
|
-
# Also, you can pass a block to set up the attribute with a default value.
|
84
|
-
#
|
85
|
-
# class Person
|
86
|
-
# cattr_writer :hair_colors do
|
87
|
-
# [:brown, :black, :blonde, :red]
|
88
|
-
# end
|
89
|
-
# end
|
90
|
-
#
|
91
|
-
# Person.class_variable_get("@@hair_colors") # => [:brown, :black, :blonde, :red]
|
92
|
-
def cattr_writer(*syms)
|
93
|
-
options = syms.extract_options!
|
94
|
-
syms.each do |sym|
|
95
|
-
class_eval(<<-EOS, __FILE__, __LINE__ + 1)
|
96
|
-
unless defined? @@#{sym}
|
97
|
-
@@#{sym} = nil
|
98
|
-
end
|
99
|
-
|
100
|
-
def self.#{sym}=(obj)
|
101
|
-
@@#{sym} = obj
|
102
|
-
end
|
103
|
-
EOS
|
104
|
-
|
105
|
-
unless options[:instance_writer] == false || options[:instance_accessor] == false
|
106
|
-
class_eval(<<-EOS, __FILE__, __LINE__ + 1)
|
107
|
-
def #{sym}=(obj)
|
108
|
-
@@#{sym} = obj
|
109
|
-
end
|
110
|
-
EOS
|
111
|
-
end
|
112
|
-
self.send("#{sym}=", yield) if block_given?
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
# Defines both class and instance accessors for class attributes.
|
117
|
-
#
|
118
|
-
# class Person
|
119
|
-
# cattr_accessor :hair_colors
|
120
|
-
# end
|
121
|
-
#
|
122
|
-
# Person.hair_colors = [:brown, :black, :blonde, :red]
|
123
|
-
# Person.hair_colors # => [:brown, :black, :blonde, :red]
|
124
|
-
# Person.new.hair_colors # => [:brown, :black, :blonde, :red]
|
125
|
-
#
|
126
|
-
# If a subclass changes the value then that would also change the value for
|
127
|
-
# parent class. Similarly if parent class changes the value then that would
|
128
|
-
# change the value of subclasses too.
|
129
|
-
#
|
130
|
-
# class Male < Person
|
131
|
-
# end
|
132
|
-
#
|
133
|
-
# Male.hair_colors << :blue
|
134
|
-
# Person.hair_colors # => [:brown, :black, :blonde, :red, :blue]
|
135
|
-
#
|
136
|
-
# To opt out of the instance writer method, pass <tt>:instance_writer => false</tt>.
|
137
|
-
# To opt out of the instance reader method, pass <tt>:instance_reader => false</tt>.
|
138
|
-
#
|
139
|
-
# class Person
|
140
|
-
# cattr_accessor :hair_colors, :instance_writer => false, :instance_reader => false
|
141
|
-
# end
|
142
|
-
#
|
143
|
-
# Person.new.hair_colors = [:brown] # => NoMethodError
|
144
|
-
# Person.new.hair_colors # => NoMethodError
|
145
|
-
#
|
146
|
-
# Or pass <tt>:instance_accessor => false</tt>, to opt out both instance methods.
|
147
|
-
#
|
148
|
-
# class Person
|
149
|
-
# cattr_accessor :hair_colors, :instance_accessor => false
|
150
|
-
# end
|
151
|
-
#
|
152
|
-
# Person.new.hair_colors = [:brown] # => NoMethodError
|
153
|
-
# Person.new.hair_colors # => NoMethodError
|
154
|
-
#
|
155
|
-
# Also you can pass a block to set up the attribute with a default value.
|
156
|
-
#
|
157
|
-
# class Person
|
158
|
-
# cattr_accessor :hair_colors do
|
159
|
-
# [:brown, :black, :blonde, :red]
|
160
|
-
# end
|
161
|
-
# end
|
162
|
-
#
|
163
|
-
# Person.class_variable_get("@@hair_colors") #=> [:brown, :black, :blonde, :red]
|
164
|
-
def cattr_accessor(*syms, &blk)
|
165
|
-
cattr_reader(*syms)
|
166
|
-
cattr_writer(*syms, &blk)
|
167
|
-
end
|
168
|
-
end
|