media-path 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +10 -0
- data/{vendor/rubyexts/spec/spec.opts → .rspec} +0 -2
- data/Gemfile +8 -0
- data/LICENSE +1 -1
- data/lib/media-path.rb +8 -7
- data/media-path.gemspec +5 -3
- data/tasks.rb +38 -0
- metadata +14 -453
- data/Rakefile +0 -24
- data/lib/media-path/version.rb +0 -7
- data/tasks/benchmark.rake +0 -11
- data/tasks/gem.rake +0 -23
- data/tasks/hooks.rake +0 -12
- data/tasks/release.rake +0 -47
- data/tasks/spec.rake +0 -27
- data/tasks/submodules.rake +0 -33
- data/tasks/yardoc.rake +0 -9
- data/url.rb +0 -20
- data/url_spec.rb +0 -35
- data/vendor/rspec/History.rdoc +0 -1512
- data/vendor/rspec/License.txt +0 -22
- data/vendor/rspec/Manifest.txt +0 -383
- data/vendor/rspec/README.rdoc +0 -55
- data/vendor/rspec/Rakefile +0 -145
- data/vendor/rspec/Ruby1.9.rdoc +0 -31
- data/vendor/rspec/TODO.txt +0 -17
- data/vendor/rspec/Upgrade.rdoc +0 -199
- data/vendor/rspec/bin/autospec +0 -4
- data/vendor/rspec/bin/spec +0 -5
- data/vendor/rspec/cucumber.yml +0 -5
- data/vendor/rspec/examples/failing/README.txt +0 -11
- data/vendor/rspec/examples/failing/diffing_spec.rb +0 -36
- data/vendor/rspec/examples/failing/failing_implicit_docstrings_example.rb +0 -17
- data/vendor/rspec/examples/failing/failure_in_after.rb +0 -10
- data/vendor/rspec/examples/failing/failure_in_before.rb +0 -10
- data/vendor/rspec/examples/failing/mocking_example.rb +0 -38
- data/vendor/rspec/examples/failing/mocking_with_flexmock.rb +0 -26
- data/vendor/rspec/examples/failing/mocking_with_mocha.rb +0 -25
- data/vendor/rspec/examples/failing/mocking_with_rr.rb +0 -27
- data/vendor/rspec/examples/failing/partial_mock_example.rb +0 -18
- data/vendor/rspec/examples/failing/pending_example.rb +0 -7
- data/vendor/rspec/examples/failing/predicate_example.rb +0 -32
- data/vendor/rspec/examples/failing/raising_example.rb +0 -47
- data/vendor/rspec/examples/failing/syntax_error_example.rb +0 -7
- data/vendor/rspec/examples/failing/team_spec.rb +0 -41
- data/vendor/rspec/examples/failing/timeout_behaviour.rb +0 -5
- data/vendor/rspec/examples/passing/custom_formatter.rb +0 -11
- data/vendor/rspec/examples/passing/custom_matchers.rb +0 -54
- data/vendor/rspec/examples/passing/dynamic_spec.rb +0 -7
- data/vendor/rspec/examples/passing/file_accessor.rb +0 -18
- data/vendor/rspec/examples/passing/file_accessor_spec.rb +0 -37
- data/vendor/rspec/examples/passing/filtered_formatter.rb +0 -17
- data/vendor/rspec/examples/passing/filtered_formatter_example.rb +0 -31
- data/vendor/rspec/examples/passing/greeter_spec.rb +0 -30
- data/vendor/rspec/examples/passing/helper_method_example.rb +0 -12
- data/vendor/rspec/examples/passing/implicit_docstrings_example.rb +0 -16
- data/vendor/rspec/examples/passing/io_processor.rb +0 -8
- data/vendor/rspec/examples/passing/io_processor_spec.rb +0 -20
- data/vendor/rspec/examples/passing/mocking_example.rb +0 -25
- data/vendor/rspec/examples/passing/multi_threaded_example_group_runner.rb +0 -26
- data/vendor/rspec/examples/passing/nested_classes_example.rb +0 -35
- data/vendor/rspec/examples/passing/options_example.rb +0 -29
- data/vendor/rspec/examples/passing/options_formatter.rb +0 -20
- data/vendor/rspec/examples/passing/partial_mock_example.rb +0 -27
- data/vendor/rspec/examples/passing/pending_example.rb +0 -18
- data/vendor/rspec/examples/passing/predicate_example.rb +0 -25
- data/vendor/rspec/examples/passing/shared_example_group_example.rb +0 -79
- data/vendor/rspec/examples/passing/shared_stack_examples.rb +0 -36
- data/vendor/rspec/examples/passing/simple_matcher_example.rb +0 -29
- data/vendor/rspec/examples/passing/stack.rb +0 -36
- data/vendor/rspec/examples/passing/stack_spec.rb +0 -63
- data/vendor/rspec/examples/passing/stack_spec_with_nested_example_groups.rb +0 -66
- data/vendor/rspec/examples/passing/stubbing_example.rb +0 -67
- data/vendor/rspec/examples/passing/yielding_example.rb +0 -31
- data/vendor/rspec/examples/ruby1.9.compatibility/access_to_constants_spec.rb +0 -85
- data/vendor/rspec/features-pending/cli/conditional_exclusion.feature +0 -39
- data/vendor/rspec/features-pending/heckle/heckle.feature +0 -56
- data/vendor/rspec/features/before_and_after_blocks/before_and_after_blocks.feature +0 -167
- data/vendor/rspec/features/command_line/line_number_option.feature +0 -56
- data/vendor/rspec/features/command_line/line_number_option_with_example_with_no_name.feature +0 -22
- data/vendor/rspec/features/example_groups/define_example_attribute.feature +0 -41
- data/vendor/rspec/features/example_groups/example_group_with_should_methods.feature +0 -29
- data/vendor/rspec/features/example_groups/implicit_docstrings.feature +0 -59
- data/vendor/rspec/features/example_groups/nested_groups.feature +0 -32
- data/vendor/rspec/features/expectations/customized_message.feature +0 -54
- data/vendor/rspec/features/expectations/expect_change.feature +0 -65
- data/vendor/rspec/features/expectations/expect_error.feature +0 -44
- data/vendor/rspec/features/extensions/custom_example_group.feature +0 -19
- data/vendor/rspec/features/formatters/custom_formatter.feature +0 -30
- data/vendor/rspec/features/interop/examples_and_tests_together.feature +0 -84
- data/vendor/rspec/features/interop/rspec_output.feature +0 -25
- data/vendor/rspec/features/interop/test_but_not_test_unit.feature +0 -26
- data/vendor/rspec/features/interop/test_case_with_should_methods.feature +0 -46
- data/vendor/rspec/features/load_paths/add_lib_to_load_path.feature +0 -20
- data/vendor/rspec/features/load_paths/add_spec_to_load_path.feature +0 -20
- data/vendor/rspec/features/matchers/define_diffable_matcher.feature +0 -26
- data/vendor/rspec/features/matchers/define_matcher.feature +0 -179
- data/vendor/rspec/features/matchers/define_matcher_outside_rspec.feature +0 -38
- data/vendor/rspec/features/matchers/define_matcher_with_fluent_interface.feature +0 -27
- data/vendor/rspec/features/matchers/define_wrapped_matcher.feature +0 -29
- data/vendor/rspec/features/matchers/match_unless_raises.feature +0 -60
- data/vendor/rspec/features/matchers/match_unless_raises_unexpected_error.feature +0 -39
- data/vendor/rspec/features/mock_framework_integration/use_flexmock.feature +0 -27
- data/vendor/rspec/features/mock_framework_integration/use_mocha.feature +0 -27
- data/vendor/rspec/features/mock_framework_integration/use_rr.feature +0 -27
- data/vendor/rspec/features/mocks/block_local_expectations.feature +0 -62
- data/vendor/rspec/features/mocks/mix_stubs_and_mocks.feature +0 -22
- data/vendor/rspec/features/mocks/stub_implementation.feature +0 -26
- data/vendor/rspec/features/pending/pending_examples.feature +0 -81
- data/vendor/rspec/features/runner/specify_line_number.feature +0 -32
- data/vendor/rspec/features/spec_helper/spec_helper.feature +0 -25
- data/vendor/rspec/features/step_definitions/running_rspec_steps.rb +0 -43
- data/vendor/rspec/features/subject/explicit_subject.feature +0 -31
- data/vendor/rspec/features/subject/implicit_subject.feature +0 -43
- data/vendor/rspec/features/support/env.rb +0 -82
- data/vendor/rspec/features/support/matchers/smart_match.rb +0 -12
- data/vendor/rspec/geminstaller.yml +0 -28
- data/vendor/rspec/init.rb +0 -9
- data/vendor/rspec/lib/autotest/discover.rb +0 -3
- data/vendor/rspec/lib/autotest/rspec.rb +0 -54
- data/vendor/rspec/lib/spec.rb +0 -8
- data/vendor/rspec/lib/spec/adapters/mock_frameworks/flexmock.rb +0 -24
- data/vendor/rspec/lib/spec/adapters/mock_frameworks/mocha.rb +0 -25
- data/vendor/rspec/lib/spec/adapters/mock_frameworks/rr.rb +0 -22
- data/vendor/rspec/lib/spec/adapters/mock_frameworks/rspec.rb +0 -21
- data/vendor/rspec/lib/spec/autorun.rb +0 -3
- data/vendor/rspec/lib/spec/deprecation.rb +0 -40
- data/vendor/rspec/lib/spec/dsl.rb +0 -1
- data/vendor/rspec/lib/spec/dsl/main.rb +0 -92
- data/vendor/rspec/lib/spec/example.rb +0 -164
- data/vendor/rspec/lib/spec/example/args_and_options.rb +0 -27
- data/vendor/rspec/lib/spec/example/before_and_after_hooks.rb +0 -93
- data/vendor/rspec/lib/spec/example/errors.rb +0 -25
- data/vendor/rspec/lib/spec/example/example_group.rb +0 -10
- data/vendor/rspec/lib/spec/example/example_group_factory.rb +0 -82
- data/vendor/rspec/lib/spec/example/example_group_hierarchy.rb +0 -53
- data/vendor/rspec/lib/spec/example/example_group_methods.rb +0 -282
- data/vendor/rspec/lib/spec/example/example_group_proxy.rb +0 -61
- data/vendor/rspec/lib/spec/example/example_matcher.rb +0 -43
- data/vendor/rspec/lib/spec/example/example_methods.rb +0 -152
- data/vendor/rspec/lib/spec/example/example_proxy.rb +0 -41
- data/vendor/rspec/lib/spec/example/module_reopening_fix.rb +0 -43
- data/vendor/rspec/lib/spec/example/pending.rb +0 -18
- data/vendor/rspec/lib/spec/example/predicate_matchers.rb +0 -46
- data/vendor/rspec/lib/spec/example/shared_example_group.rb +0 -59
- data/vendor/rspec/lib/spec/example/subject.rb +0 -108
- data/vendor/rspec/lib/spec/expectations.rb +0 -35
- data/vendor/rspec/lib/spec/expectations/errors.rb +0 -12
- data/vendor/rspec/lib/spec/expectations/extensions.rb +0 -1
- data/vendor/rspec/lib/spec/expectations/extensions/kernel.rb +0 -52
- data/vendor/rspec/lib/spec/expectations/fail_with.rb +0 -45
- data/vendor/rspec/lib/spec/expectations/handler.rb +0 -50
- data/vendor/rspec/lib/spec/extensions/instance_exec.rb +0 -31
- data/vendor/rspec/lib/spec/interop/test.rb +0 -44
- data/vendor/rspec/lib/spec/interop/test/unit/autorunner.rb +0 -6
- data/vendor/rspec/lib/spec/interop/test/unit/testcase.rb +0 -56
- data/vendor/rspec/lib/spec/interop/test/unit/testresult.rb +0 -6
- data/vendor/rspec/lib/spec/interop/test/unit/testsuite_adapter.rb +0 -34
- data/vendor/rspec/lib/spec/interop/test/unit/ui/console/testrunner.rb +0 -61
- data/vendor/rspec/lib/spec/matchers.rb +0 -195
- data/vendor/rspec/lib/spec/matchers/be.rb +0 -211
- data/vendor/rspec/lib/spec/matchers/be_close.rb +0 -32
- data/vendor/rspec/lib/spec/matchers/be_instance_of.rb +0 -26
- data/vendor/rspec/lib/spec/matchers/be_kind_of.rb +0 -26
- data/vendor/rspec/lib/spec/matchers/change.rb +0 -151
- data/vendor/rspec/lib/spec/matchers/compatibility.rb +0 -14
- data/vendor/rspec/lib/spec/matchers/dsl.rb +0 -20
- data/vendor/rspec/lib/spec/matchers/eql.rb +0 -42
- data/vendor/rspec/lib/spec/matchers/equal.rb +0 -53
- data/vendor/rspec/lib/spec/matchers/errors.rb +0 -5
- data/vendor/rspec/lib/spec/matchers/exist.rb +0 -16
- data/vendor/rspec/lib/spec/matchers/generated_descriptions.rb +0 -36
- data/vendor/rspec/lib/spec/matchers/has.rb +0 -35
- data/vendor/rspec/lib/spec/matchers/have.rb +0 -152
- data/vendor/rspec/lib/spec/matchers/include.rb +0 -44
- data/vendor/rspec/lib/spec/matchers/match.rb +0 -21
- data/vendor/rspec/lib/spec/matchers/match_array.rb +0 -71
- data/vendor/rspec/lib/spec/matchers/matcher.rb +0 -102
- data/vendor/rspec/lib/spec/matchers/method_missing.rb +0 -9
- data/vendor/rspec/lib/spec/matchers/operator_matcher.rb +0 -78
- data/vendor/rspec/lib/spec/matchers/pretty.rb +0 -37
- data/vendor/rspec/lib/spec/matchers/raise_error.rb +0 -129
- data/vendor/rspec/lib/spec/matchers/respond_to.rb +0 -71
- data/vendor/rspec/lib/spec/matchers/satisfy.rb +0 -47
- data/vendor/rspec/lib/spec/matchers/simple_matcher.rb +0 -133
- data/vendor/rspec/lib/spec/matchers/throw_symbol.rb +0 -104
- data/vendor/rspec/lib/spec/matchers/wrap_expectation.rb +0 -55
- data/vendor/rspec/lib/spec/mocks.rb +0 -200
- data/vendor/rspec/lib/spec/mocks/argument_expectation.rb +0 -51
- data/vendor/rspec/lib/spec/mocks/argument_matchers.rb +0 -237
- data/vendor/rspec/lib/spec/mocks/error_generator.rb +0 -92
- data/vendor/rspec/lib/spec/mocks/errors.rb +0 -10
- data/vendor/rspec/lib/spec/mocks/example_methods.rb +0 -69
- data/vendor/rspec/lib/spec/mocks/extensions.rb +0 -1
- data/vendor/rspec/lib/spec/mocks/extensions/object.rb +0 -3
- data/vendor/rspec/lib/spec/mocks/framework.rb +0 -15
- data/vendor/rspec/lib/spec/mocks/message_expectation.rb +0 -343
- data/vendor/rspec/lib/spec/mocks/methods.rb +0 -89
- data/vendor/rspec/lib/spec/mocks/mock.rb +0 -71
- data/vendor/rspec/lib/spec/mocks/order_group.rb +0 -29
- data/vendor/rspec/lib/spec/mocks/proxy.rb +0 -245
- data/vendor/rspec/lib/spec/mocks/space.rb +0 -28
- data/vendor/rspec/lib/spec/rake/spectask.rb +0 -230
- data/vendor/rspec/lib/spec/rake/verify_rcov.rb +0 -52
- data/vendor/rspec/lib/spec/ruby.rb +0 -9
- data/vendor/rspec/lib/spec/runner.rb +0 -66
- data/vendor/rspec/lib/spec/runner/backtrace_tweaker.rb +0 -77
- data/vendor/rspec/lib/spec/runner/class_and_arguments_parser.rb +0 -14
- data/vendor/rspec/lib/spec/runner/command_line.rb +0 -15
- data/vendor/rspec/lib/spec/runner/configuration.rb +0 -194
- data/vendor/rspec/lib/spec/runner/differs/default.rb +0 -93
- data/vendor/rspec/lib/spec/runner/differs/load-diff-lcs.rb +0 -12
- data/vendor/rspec/lib/spec/runner/drb_command_line.rb +0 -32
- data/vendor/rspec/lib/spec/runner/example_group_runner.rb +0 -58
- data/vendor/rspec/lib/spec/runner/extensions/kernel.rb +0 -9
- data/vendor/rspec/lib/spec/runner/formatter/base_formatter.rb +0 -139
- data/vendor/rspec/lib/spec/runner/formatter/base_text_formatter.rb +0 -142
- data/vendor/rspec/lib/spec/runner/formatter/failing_example_groups_formatter.rb +0 -25
- data/vendor/rspec/lib/spec/runner/formatter/failing_examples_formatter.rb +0 -20
- data/vendor/rspec/lib/spec/runner/formatter/html_formatter.rb +0 -338
- data/vendor/rspec/lib/spec/runner/formatter/nested_text_formatter.rb +0 -47
- data/vendor/rspec/lib/spec/runner/formatter/no_op_method_missing.rb +0 -21
- data/vendor/rspec/lib/spec/runner/formatter/profile_formatter.rb +0 -47
- data/vendor/rspec/lib/spec/runner/formatter/progress_bar_formatter.rb +0 -33
- data/vendor/rspec/lib/spec/runner/formatter/silent_formatter.rb +0 -10
- data/vendor/rspec/lib/spec/runner/formatter/snippet_extractor.rb +0 -52
- data/vendor/rspec/lib/spec/runner/formatter/specdoc_formatter.rb +0 -33
- data/vendor/rspec/lib/spec/runner/formatter/text_mate_formatter.rb +0 -16
- data/vendor/rspec/lib/spec/runner/heckle_runner.rb +0 -72
- data/vendor/rspec/lib/spec/runner/heckle_runner_unsupported.rb +0 -10
- data/vendor/rspec/lib/spec/runner/line_number_query.rb +0 -78
- data/vendor/rspec/lib/spec/runner/option_parser.rb +0 -225
- data/vendor/rspec/lib/spec/runner/options.rb +0 -405
- data/vendor/rspec/lib/spec/runner/reporter.rb +0 -171
- data/vendor/rspec/lib/spec/stubs/cucumber.rb +0 -5
- data/vendor/rspec/lib/spec/test/unit.rb +0 -10
- data/vendor/rspec/lib/spec/version.rb +0 -14
- data/vendor/rspec/resources/helpers/cmdline.rb +0 -8
- data/vendor/rspec/resources/rake/examples.rake +0 -7
- data/vendor/rspec/resources/rake/examples_with_rcov.rake +0 -9
- data/vendor/rspec/resources/rake/failing_examples_with_html.rake +0 -9
- data/vendor/rspec/resources/rake/verify_rcov.rake +0 -7
- data/vendor/rspec/spec/README.jruby +0 -15
- data/vendor/rspec/spec/autotest/autotest_helper.rb +0 -8
- data/vendor/rspec/spec/autotest/autotest_matchers.rb +0 -38
- data/vendor/rspec/spec/autotest/discover_spec.rb +0 -8
- data/vendor/rspec/spec/autotest/failed_results_re_spec.rb +0 -31
- data/vendor/rspec/spec/autotest/rspec_spec.rb +0 -126
- data/vendor/rspec/spec/ruby_forker.rb +0 -13
- data/vendor/rspec/spec/spec.opts +0 -6
- data/vendor/rspec/spec/spec/dsl/main_spec.rb +0 -95
- data/vendor/rspec/spec/spec/example/example_group_class_definition_spec.rb +0 -51
- data/vendor/rspec/spec/spec/example/example_group_factory_spec.rb +0 -180
- data/vendor/rspec/spec/spec/example/example_group_methods_spec.rb +0 -759
- data/vendor/rspec/spec/spec/example/example_group_proxy_spec.rb +0 -107
- data/vendor/rspec/spec/spec/example/example_group_spec.rb +0 -643
- data/vendor/rspec/spec/spec/example/example_matcher_spec.rb +0 -86
- data/vendor/rspec/spec/spec/example/example_methods_spec.rb +0 -162
- data/vendor/rspec/spec/spec/example/example_proxy_spec.rb +0 -57
- data/vendor/rspec/spec/spec/example/helper_method_spec.rb +0 -24
- data/vendor/rspec/spec/spec/example/nested_example_group_spec.rb +0 -71
- data/vendor/rspec/spec/spec/example/pending_module_spec.rb +0 -58
- data/vendor/rspec/spec/spec/example/predicate_matcher_spec.rb +0 -41
- data/vendor/rspec/spec/spec/example/shared_example_group_spec.rb +0 -257
- data/vendor/rspec/spec/spec/example/subclassing_example_group_spec.rb +0 -25
- data/vendor/rspec/spec/spec/example/subject_spec.rb +0 -103
- data/vendor/rspec/spec/spec/expectations/differs/default_spec.rb +0 -194
- data/vendor/rspec/spec/spec/expectations/extensions/kernel_spec.rb +0 -45
- data/vendor/rspec/spec/spec/expectations/fail_with_spec.rb +0 -96
- data/vendor/rspec/spec/spec/expectations/handler_spec.rb +0 -206
- data/vendor/rspec/spec/spec/expectations/wrap_expectation_spec.rb +0 -30
- data/vendor/rspec/spec/spec/interop/test/unit/resources/spec_that_fails.rb +0 -10
- data/vendor/rspec/spec/spec/interop/test/unit/resources/spec_that_passes.rb +0 -10
- data/vendor/rspec/spec/spec/interop/test/unit/resources/spec_with_errors.rb +0 -10
- data/vendor/rspec/spec/spec/interop/test/unit/resources/spec_with_options_hash.rb +0 -13
- data/vendor/rspec/spec/spec/interop/test/unit/resources/test_case_that_fails.rb +0 -10
- data/vendor/rspec/spec/spec/interop/test/unit/resources/test_case_that_passes.rb +0 -10
- data/vendor/rspec/spec/spec/interop/test/unit/resources/test_case_with_errors.rb +0 -10
- data/vendor/rspec/spec/spec/interop/test/unit/resources/test_case_with_various_names.rb +0 -22
- data/vendor/rspec/spec/spec/interop/test/unit/resources/testsuite_adapter_spec_with_test_unit.rb +0 -38
- data/vendor/rspec/spec/spec/interop/test/unit/spec_spec.rb +0 -48
- data/vendor/rspec/spec/spec/interop/test/unit/test_unit_spec_helper.rb +0 -18
- data/vendor/rspec/spec/spec/interop/test/unit/testcase_spec.rb +0 -50
- data/vendor/rspec/spec/spec/interop/test/unit/testsuite_adapter_spec.rb +0 -9
- data/vendor/rspec/spec/spec/matchers/be_close_spec.rb +0 -50
- data/vendor/rspec/spec/spec/matchers/be_instance_of_spec.rb +0 -36
- data/vendor/rspec/spec/spec/matchers/be_kind_of_spec.rb +0 -33
- data/vendor/rspec/spec/spec/matchers/be_spec.rb +0 -419
- data/vendor/rspec/spec/spec/matchers/change_spec.rb +0 -349
- data/vendor/rspec/spec/spec/matchers/compatibility_spec.rb +0 -28
- data/vendor/rspec/spec/spec/matchers/description_generation_spec.rb +0 -160
- data/vendor/rspec/spec/spec/matchers/dsl_spec.rb +0 -34
- data/vendor/rspec/spec/spec/matchers/eql_spec.rb +0 -33
- data/vendor/rspec/spec/spec/matchers/equal_spec.rb +0 -57
- data/vendor/rspec/spec/spec/matchers/exist_spec.rb +0 -65
- data/vendor/rspec/spec/spec/matchers/has_spec.rb +0 -190
- data/vendor/rspec/spec/spec/matchers/have_spec.rb +0 -396
- data/vendor/rspec/spec/spec/matchers/include_spec.rb +0 -88
- data/vendor/rspec/spec/spec/matchers/match_array_spec.rb +0 -108
- data/vendor/rspec/spec/spec/matchers/match_spec.rb +0 -57
- data/vendor/rspec/spec/spec/matchers/matcher_methods_spec.rb +0 -63
- data/vendor/rspec/spec/spec/matchers/matcher_spec.rb +0 -273
- data/vendor/rspec/spec/spec/matchers/matchers_spec.rb +0 -2
- data/vendor/rspec/spec/spec/matchers/operator_matcher_spec.rb +0 -191
- data/vendor/rspec/spec/spec/matchers/raise_error_spec.rb +0 -333
- data/vendor/rspec/spec/spec/matchers/respond_to_spec.rb +0 -116
- data/vendor/rspec/spec/spec/matchers/satisfy_spec.rb +0 -36
- data/vendor/rspec/spec/spec/matchers/simple_matcher_spec.rb +0 -93
- data/vendor/rspec/spec/spec/matchers/throw_symbol_spec.rb +0 -96
- data/vendor/rspec/spec/spec/mocks/and_yield_spec.rb +0 -117
- data/vendor/rspec/spec/spec/mocks/any_number_of_times_spec.rb +0 -36
- data/vendor/rspec/spec/spec/mocks/argument_expectation_spec.rb +0 -23
- data/vendor/rspec/spec/spec/mocks/argument_matchers_spec.rb +0 -19
- data/vendor/rspec/spec/spec/mocks/at_least_spec.rb +0 -97
- data/vendor/rspec/spec/spec/mocks/at_most_spec.rb +0 -93
- data/vendor/rspec/spec/spec/mocks/bug_report_10260_spec.rb +0 -8
- data/vendor/rspec/spec/spec/mocks/bug_report_10263_spec.rb +0 -27
- data/vendor/rspec/spec/spec/mocks/bug_report_11545_spec.rb +0 -32
- data/vendor/rspec/spec/spec/mocks/bug_report_15719_spec.rb +0 -30
- data/vendor/rspec/spec/spec/mocks/bug_report_496_spec.rb +0 -19
- data/vendor/rspec/spec/spec/mocks/bug_report_600_spec.rb +0 -22
- data/vendor/rspec/spec/spec/mocks/bug_report_7611_spec.rb +0 -19
- data/vendor/rspec/spec/spec/mocks/bug_report_7805_spec.rb +0 -22
- data/vendor/rspec/spec/spec/mocks/bug_report_8165_spec.rb +0 -31
- data/vendor/rspec/spec/spec/mocks/bug_report_8302_spec.rb +0 -26
- data/vendor/rspec/spec/spec/mocks/bug_report_830_spec.rb +0 -21
- data/vendor/rspec/spec/spec/mocks/double_spec.rb +0 -12
- data/vendor/rspec/spec/spec/mocks/failing_argument_matchers_spec.rb +0 -95
- data/vendor/rspec/spec/spec/mocks/hash_including_matcher_spec.rb +0 -90
- data/vendor/rspec/spec/spec/mocks/hash_not_including_matcher_spec.rb +0 -67
- data/vendor/rspec/spec/spec/mocks/mock_ordering_spec.rb +0 -94
- data/vendor/rspec/spec/spec/mocks/mock_space_spec.rb +0 -54
- data/vendor/rspec/spec/spec/mocks/mock_spec.rb +0 -594
- data/vendor/rspec/spec/spec/mocks/multiple_return_value_spec.rb +0 -113
- data/vendor/rspec/spec/spec/mocks/nil_expectation_warning_spec.rb +0 -53
- data/vendor/rspec/spec/spec/mocks/null_object_mock_spec.rb +0 -54
- data/vendor/rspec/spec/spec/mocks/once_counts_spec.rb +0 -53
- data/vendor/rspec/spec/spec/mocks/options_hash_spec.rb +0 -35
- data/vendor/rspec/spec/spec/mocks/partial_mock_spec.rb +0 -164
- data/vendor/rspec/spec/spec/mocks/partial_mock_using_mocks_directly_spec.rb +0 -66
- data/vendor/rspec/spec/spec/mocks/passing_argument_matchers_spec.rb +0 -145
- data/vendor/rspec/spec/spec/mocks/precise_counts_spec.rb +0 -52
- data/vendor/rspec/spec/spec/mocks/record_messages_spec.rb +0 -26
- data/vendor/rspec/spec/spec/mocks/stub_chain_spec.rb +0 -42
- data/vendor/rspec/spec/spec/mocks/stub_implementation_spec.rb +0 -31
- data/vendor/rspec/spec/spec/mocks/stub_spec.rb +0 -203
- data/vendor/rspec/spec/spec/mocks/stubbed_message_expectations_spec.rb +0 -26
- data/vendor/rspec/spec/spec/mocks/twice_counts_spec.rb +0 -67
- data/vendor/rspec/spec/spec/mocks/unstub_spec.rb +0 -127
- data/vendor/rspec/spec/spec/package/bin_spec_spec.rb +0 -16
- data/vendor/rspec/spec/spec/rake/spectask_spec.rb +0 -150
- data/vendor/rspec/spec/spec/runner/class_and_argument_parser_spec.rb +0 -23
- data/vendor/rspec/spec/spec/runner/command_line_spec.rb +0 -162
- data/vendor/rspec/spec/spec/runner/configuration_spec.rb +0 -320
- data/vendor/rspec/spec/spec/runner/drb_command_line_spec.rb +0 -146
- data/vendor/rspec/spec/spec/runner/empty_file.txt +0 -0
- data/vendor/rspec/spec/spec/runner/example_group_runner_spec.rb +0 -26
- data/vendor/rspec/spec/spec/runner/examples.txt +0 -2
- data/vendor/rspec/spec/spec/runner/failed.txt +0 -3
- data/vendor/rspec/spec/spec/runner/formatter/base_formatter_spec.rb +0 -30
- data/vendor/rspec/spec/spec/runner/formatter/base_text_formatter_spec.rb +0 -113
- data/vendor/rspec/spec/spec/runner/formatter/failing_example_groups_formatter_spec.rb +0 -45
- data/vendor/rspec/spec/spec/runner/formatter/failing_examples_formatter_spec.rb +0 -33
- data/vendor/rspec/spec/spec/runner/formatter/html_formatted-1.8.6-jruby.html +0 -377
- data/vendor/rspec/spec/spec/runner/formatter/html_formatted-1.8.6.html +0 -377
- data/vendor/rspec/spec/spec/runner/formatter/html_formatted-1.8.7.html +0 -377
- data/vendor/rspec/spec/spec/runner/formatter/html_formatted-1.9.1.html +0 -377
- data/vendor/rspec/spec/spec/runner/formatter/html_formatter_spec.rb +0 -118
- data/vendor/rspec/spec/spec/runner/formatter/nested_text_formatter_spec.rb +0 -305
- data/vendor/rspec/spec/spec/runner/formatter/profile_formatter_spec.rb +0 -70
- data/vendor/rspec/spec/spec/runner/formatter/progress_bar_formatter_spec.rb +0 -149
- data/vendor/rspec/spec/spec/runner/formatter/snippet_extractor_spec.rb +0 -18
- data/vendor/rspec/spec/spec/runner/formatter/specdoc_formatter_spec.rb +0 -159
- data/vendor/rspec/spec/spec/runner/formatter/text_mate_formatted-1.8.6-jruby.html +0 -371
- data/vendor/rspec/spec/spec/runner/formatter/text_mate_formatted-1.8.6.html +0 -371
- data/vendor/rspec/spec/spec/runner/formatter/text_mate_formatted-1.8.7.html +0 -371
- data/vendor/rspec/spec/spec/runner/formatter/text_mate_formatted-1.9.1.html +0 -371
- data/vendor/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb +0 -106
- data/vendor/rspec/spec/spec/runner/heckle_runner_spec.rb +0 -78
- data/vendor/rspec/spec/spec/runner/heckler_spec.rb +0 -20
- data/vendor/rspec/spec/spec/runner/line_number_query/line_number_query_fixture.rb +0 -70
- data/vendor/rspec/spec/spec/runner/line_number_query_spec.rb +0 -129
- data/vendor/rspec/spec/spec/runner/noisy_backtrace_tweaker_spec.rb +0 -51
- data/vendor/rspec/spec/spec/runner/option_parser_spec.rb +0 -554
- data/vendor/rspec/spec/spec/runner/options_spec.rb +0 -554
- data/vendor/rspec/spec/spec/runner/output_one_time_fixture.rb +0 -7
- data/vendor/rspec/spec/spec/runner/output_one_time_fixture_runner.rb +0 -7
- data/vendor/rspec/spec/spec/runner/output_one_time_spec.rb +0 -15
- data/vendor/rspec/spec/spec/runner/quiet_backtrace_tweaker_spec.rb +0 -123
- data/vendor/rspec/spec/spec/runner/reporter_spec.rb +0 -244
- data/vendor/rspec/spec/spec/runner/resources/a_bar.rb +0 -0
- data/vendor/rspec/spec/spec/runner/resources/a_foo.rb +0 -0
- data/vendor/rspec/spec/spec/runner/resources/a_spec.rb +0 -1
- data/vendor/rspec/spec/spec/runner/resources/custom_example_group_runner.rb +0 -14
- data/vendor/rspec/spec/spec/runner/resources/utf8_encoded.rb +0 -8
- data/vendor/rspec/spec/spec/runner/spec.opts +0 -2
- data/vendor/rspec/spec/spec/runner/spec_drb.opts +0 -2
- data/vendor/rspec/spec/spec/runner/spec_spaced.opts +0 -2
- data/vendor/rspec/spec/spec/runner_spec.rb +0 -13
- data/vendor/rspec/spec/spec_helper.rb +0 -112
- data/vendor/rspec/spec/support/macros.rb +0 -29
- data/vendor/rspec/spec/support/spec_classes.rb +0 -133
- data/vendor/rubyexts/CHANGELOG +0 -2
- data/vendor/rubyexts/LICENSE +0 -20
- data/vendor/rubyexts/README.textile +0 -0
- data/vendor/rubyexts/Rakefile +0 -79
- data/vendor/rubyexts/TODO.txt +0 -6
- data/vendor/rubyexts/lib/rubyexts.rb +0 -102
- data/vendor/rubyexts/lib/rubyexts/array.rb +0 -20
- data/vendor/rubyexts/lib/rubyexts/attribute.rb +0 -151
- data/vendor/rubyexts/lib/rubyexts/capture_io.rb +0 -32
- data/vendor/rubyexts/lib/rubyexts/class.rb +0 -177
- data/vendor/rubyexts/lib/rubyexts/colored_string.rb +0 -103
- data/vendor/rubyexts/lib/rubyexts/enumerable.rb +0 -30
- data/vendor/rubyexts/lib/rubyexts/file.rb +0 -84
- data/vendor/rubyexts/lib/rubyexts/hash.rb +0 -180
- data/vendor/rubyexts/lib/rubyexts/kernel.rb +0 -91
- data/vendor/rubyexts/lib/rubyexts/module.rb +0 -53
- data/vendor/rubyexts/lib/rubyexts/object.rb +0 -56
- data/vendor/rubyexts/lib/rubyexts/object_space.rb +0 -16
- data/vendor/rubyexts/lib/rubyexts/os.rb +0 -89
- data/vendor/rubyexts/lib/rubyexts/platform.rb +0 -27
- data/vendor/rubyexts/lib/rubyexts/random.rb +0 -25
- data/vendor/rubyexts/lib/rubyexts/string.rb +0 -92
- data/vendor/rubyexts/lib/rubyexts/time.rb +0 -15
- data/vendor/rubyexts/lib/rubyexts/time_dsl.rb +0 -62
- data/vendor/rubyexts/lib/rubyexts/try_dup.rb +0 -43
- data/vendor/rubyexts/lib/rubyexts/unique_array.rb +0 -16
- data/vendor/rubyexts/rubyexts.gemspec +0 -36
- data/vendor/rubyexts/script/spec +0 -12
- data/vendor/rubyexts/spec/rubyexts/array_spec.rb +0 -19
- data/vendor/rubyexts/spec/rubyexts/attribute_spec.rb +0 -37
- data/vendor/rubyexts/spec/rubyexts/class_spec.rb +0 -1
- data/vendor/rubyexts/spec/rubyexts/cli_spec.rb +0 -0
- data/vendor/rubyexts/spec/rubyexts/colored_string_spec.rb +0 -9
- data/vendor/rubyexts/spec/rubyexts/enumerable_spec.rb +0 -52
- data/vendor/rubyexts/spec/rubyexts/file_spec.rb +0 -78
- data/vendor/rubyexts/spec/rubyexts/hash_spec.rb +0 -91
- data/vendor/rubyexts/spec/rubyexts/kernel_spec.rb +0 -9
- data/vendor/rubyexts/spec/rubyexts/module_spec.rb +0 -0
- data/vendor/rubyexts/spec/rubyexts/object_space_spec.rb +0 -17
- data/vendor/rubyexts/spec/rubyexts/object_spec.rb +0 -57
- data/vendor/rubyexts/spec/rubyexts/os_spec.rb +0 -121
- data/vendor/rubyexts/spec/rubyexts/platform_spec.rb +0 -0
- data/vendor/rubyexts/spec/rubyexts/random_spec.rb +0 -31
- data/vendor/rubyexts/spec/rubyexts/string_spec.rb +0 -23
- data/vendor/rubyexts/spec/rubyexts/time_dsl_spec.rb +0 -88
- data/vendor/rubyexts/spec/rubyexts/time_spec.rb +0 -11
- data/vendor/rubyexts/spec/rubyexts/unique_array_spec.rb +0 -0
- data/vendor/rubyexts/spec/rubyexts_spec.rb +0 -182
- data/vendor/rubyexts/spec/spec_helper.rb +0 -16
@@ -1,30 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
module Enumerable
|
4
|
-
# Enumerable#none? is the logical opposite of the builtin method Enumerable#any?. It
|
5
|
-
# returns +true+ if and only if _none_ of the elements in the collection satisfy the
|
6
|
-
# predicate.
|
7
|
-
#
|
8
|
-
# If no predicate is provided, Enumerable#none? returns +true+ if and only if _none_ of the
|
9
|
-
# elements have a true value (i.e. not +nil+ or +false+).
|
10
|
-
#
|
11
|
-
# @author Botanicus
|
12
|
-
# @from Extensions
|
13
|
-
# @since 0.0.3
|
14
|
-
# @yield [block] Block which will be evaluated in Project.setttings object.
|
15
|
-
# @yieldparam [item] Each item of array-like collection
|
16
|
-
# @yieldparam [key, value] Each item of hash-like collection
|
17
|
-
# @option params [String, Array<String>] :exclude File or list of files or globs relative to base directory
|
18
|
-
# @raise [LoadError] If base directory doesn't exist
|
19
|
-
# @raise [ArgumentError] If first argument isn't a glob
|
20
|
-
# @return [Array<String>] List of successfully loaded files
|
21
|
-
# @example
|
22
|
-
# [].none? # => true
|
23
|
-
# [nil].none? # => true
|
24
|
-
# [5,8,9].none? # => false
|
25
|
-
# (1...10).none? { |n| n < 0 } # => true
|
26
|
-
# (1...10).none? { |n| n > 0 } # => false
|
27
|
-
def none?(&block)
|
28
|
-
not self.any?(&block)
|
29
|
-
end
|
30
|
-
end
|
@@ -1,84 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
class File
|
4
|
-
# Append given chunks to the existing file or create new one.
|
5
|
-
# It use <tt>IO#puts</tt> for write to given file.
|
6
|
-
#
|
7
|
-
# @author Botanicus
|
8
|
-
# @since 0.0.3
|
9
|
-
# @param [String] file Path to file. You can use <tt>~</tt>, <tt>~user</tt> or similar expressions.
|
10
|
-
# @param [String, Object] *chunks Chunks which will be written to the file
|
11
|
-
# @raise [Errno::ENOENT] If parent directory of given file doesn't exist
|
12
|
-
# @raise [Errno::EACCES] If you don't have permissions to write to given file
|
13
|
-
# @return [String] Expanded path to given file
|
14
|
-
# @example
|
15
|
-
# File.append "~/.bashrc", source # => "/Users/botanicus/.bashrc"
|
16
|
-
def self.append(file, *chunks)
|
17
|
-
self.write(:puts, "a", file, *chunks)
|
18
|
-
end
|
19
|
-
|
20
|
-
# Append given chunks to the existing file or create new one.
|
21
|
-
# It use <tt>IO#print</tt> for write to given file.
|
22
|
-
#
|
23
|
-
# @author Botanicus
|
24
|
-
# @since 0.0.3
|
25
|
-
# @param [String] file Path to file. You can use <tt>~</tt>, <tt>~user</tt> or similar expressions.
|
26
|
-
# @param [String, Object] *chunks Chunks which will be written to the file
|
27
|
-
# @raise [Errno::ENOENT] If parent directory of given file doesn't exist
|
28
|
-
# @raise [Errno::EACCES] If you don't have permissions to write to given file
|
29
|
-
# @return [String] Expanded path to given file
|
30
|
-
# @example
|
31
|
-
# File.append "~/.bashrc", source # => "/Users/botanicus/.bashrc"
|
32
|
-
def self.add(file, *chunks)
|
33
|
-
self.write(:print, "a", file, *chunks)
|
34
|
-
end
|
35
|
-
|
36
|
-
# Create new file and write there given chunks.
|
37
|
-
# It use <tt>IO#puts</tt> for write to given file.
|
38
|
-
#
|
39
|
-
# @author Botanicus
|
40
|
-
# @since 0.0.3
|
41
|
-
# @param [String] file Path to file. You can use <tt>~</tt>, <tt>~user</tt> or similar expressions.
|
42
|
-
# @param [String, Object] *chunks Chunks which will be written to the file
|
43
|
-
# @raise [Errno::ENOENT] If parent directory of given file doesn't exist
|
44
|
-
# @raise [Errno::EACCES] If you don't have permissions to write to given file
|
45
|
-
# @return [String] Expanded path to given file
|
46
|
-
# @example
|
47
|
-
# File.puts "~/.bashrc", source # => "/Users/botanicus/.bashrc"
|
48
|
-
def self.puts(file, *chunks)
|
49
|
-
self.write(:puts, "w", file, *chunks)
|
50
|
-
end
|
51
|
-
|
52
|
-
# Create new file and write there given chunks.
|
53
|
-
# It use <tt>IO#print</tt> for write to given file.
|
54
|
-
#
|
55
|
-
# @author Botanicus
|
56
|
-
# @since 0.0.3
|
57
|
-
# @param [String] file Path to file. You can use <tt>~</tt>, <tt>~user</tt> or similar expressions.
|
58
|
-
# @param [String, Object] *chunks Chunks which will be written to the file
|
59
|
-
# @raise [Errno::ENOENT] If parent directory of given file doesn't exist
|
60
|
-
# @raise [Errno::EACCES] If you don't have permissions to write to given file
|
61
|
-
# @return [String] Expanded path to given file
|
62
|
-
# @example
|
63
|
-
# File.print "~/.bashrc", source # => "/Users/botanicus/.bashrc"
|
64
|
-
def self.print(file, *chunks)
|
65
|
-
self.write(:print, "w", file, *chunks)
|
66
|
-
end
|
67
|
-
|
68
|
-
# Write data to file with given method.
|
69
|
-
#
|
70
|
-
# @author Botanicus
|
71
|
-
# @since 0.0.3
|
72
|
-
# @param [String] file Path to file. You can use <tt>~</tt>, <tt>~user</tt> or similar expressions.
|
73
|
-
# @param [String, Object] *chunks Chunks which will be written to the file
|
74
|
-
# @raise [Errno::ENOENT] If parent directory of given file doesn't exist
|
75
|
-
# @raise [Errno::EACCES] If you don't have permissions to write to given file
|
76
|
-
# @return [String] Expanded path to given file
|
77
|
-
# @example
|
78
|
-
# File.write :printf, "w", "~/.bashrc", "%d %04x", 123, 123 # => "/Users/botanicus/.bashrc"
|
79
|
-
def self.write(method, mode, file, *args)
|
80
|
-
self.expand_path(file).tap do |path|
|
81
|
-
self.open(path, mode) { |file| file.send(method, *args) }
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
@@ -1,180 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
class Hash
|
4
|
-
# Return duplication of self with all keys non-recursively converted to symbols
|
5
|
-
#
|
6
|
-
# @author Botanicus
|
7
|
-
# @since 0.0.2
|
8
|
-
# @return [Hash] A hash with all keys transformed into symbols
|
9
|
-
def symbolize_keys
|
10
|
-
self.inject(Hash.new) do |result, array|
|
11
|
-
result[array.first.to_sym] = array.last
|
12
|
-
result
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
# Replace keys in self by coresponding symbols
|
17
|
-
#
|
18
|
-
# @author Botanicus
|
19
|
-
# @since 0.0.2
|
20
|
-
# @return [Hash] A hash with all keys transformed into symbols
|
21
|
-
def symbolize_keys!
|
22
|
-
self.replace(self.symbolize_keys)
|
23
|
-
end
|
24
|
-
|
25
|
-
# Return duplication of self with all keys recursively converted to symbols
|
26
|
-
#
|
27
|
-
# @author Botanicus
|
28
|
-
# @since 0.0.2
|
29
|
-
# @return [Hash] A hash with all keys transformed into symbols even in inner hashes
|
30
|
-
def deep_symbolize_keys
|
31
|
-
self.inject(Hash.new) do |result, array|
|
32
|
-
key, value = array.first, array.last
|
33
|
-
if value.respond_to?(:symbolize_keys)
|
34
|
-
result[key.to_sym] = value.symbolize_keys
|
35
|
-
else
|
36
|
-
result[key.to_sym] = value
|
37
|
-
end
|
38
|
-
result
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
# Recursively replace keys in self by coresponding symbols
|
43
|
-
#
|
44
|
-
# @author Botanicus
|
45
|
-
# @since 0.0.2
|
46
|
-
# @return [Hash] A hash with all keys transformed into symbols even in inner hashes
|
47
|
-
def deep_symbolize_keys!
|
48
|
-
self.replace(self.deep_symbolize_keys)
|
49
|
-
end
|
50
|
-
|
51
|
-
# Returns the value of self for each argument and deletes those entries.
|
52
|
-
#
|
53
|
-
# @author Botanicus
|
54
|
-
# @since 0.0.2
|
55
|
-
# @param [*args] the keys whose values should be extracted and deleted.
|
56
|
-
# @return [Array<Object>] The values of the provided arguments in corresponding order.
|
57
|
-
# @api public
|
58
|
-
# @example
|
59
|
-
# hash = {one: 1, two: 2, three: 3}
|
60
|
-
# hash.extract!(:one, :two) # => [1, 2]
|
61
|
-
# hash # => {:three => 3}
|
62
|
-
def extract!(*args)
|
63
|
-
args.map do |arg|
|
64
|
-
self.delete(arg)
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
# @author Botanicus
|
69
|
-
# @since 0.0.2
|
70
|
-
# @return [String] A string formatted for HTML attributes
|
71
|
-
# @example
|
72
|
-
# {class: "inner", id: "post-#{@post.id}"}.to_html_attrs # => "class='inner' id='post-1'"
|
73
|
-
def to_html_attrs
|
74
|
-
self.map { |key, value| "#{key}='#{value}'" }.join(" ")
|
75
|
-
end
|
76
|
-
|
77
|
-
# @author Botanicus
|
78
|
-
# @since 0.0.2
|
79
|
-
# @return [String] A string formatted for URL
|
80
|
-
# @example
|
81
|
-
# {action: "rate", rating: 2}.to_url_attrs # => "action=rate&rating=2"
|
82
|
-
def to_url_attrs
|
83
|
-
self.map { |key, value| "#{key}=#{value}" }.join("&")
|
84
|
-
end
|
85
|
-
|
86
|
-
# @author Botanicus
|
87
|
-
# @since 0.0.2
|
88
|
-
# @return [String] Merge self into hash given as argument
|
89
|
-
def reverse_merge(another)
|
90
|
-
another.merge(self)
|
91
|
-
end
|
92
|
-
|
93
|
-
# @author Botanicus
|
94
|
-
# @since 0.0.2
|
95
|
-
# @return [String] Replace self by result of merge self into hash given as argument
|
96
|
-
def reverse_merge!(another)
|
97
|
-
self.replace(self.reverse_merge(another))
|
98
|
-
end
|
99
|
-
|
100
|
-
# @author Botanicus
|
101
|
-
# @since 0.0.2
|
102
|
-
# @deprecated
|
103
|
-
def to_native
|
104
|
-
self.each do |key, value|
|
105
|
-
value = case value
|
106
|
-
when "true" then true
|
107
|
-
when "false" then false
|
108
|
-
when "nil" then nil
|
109
|
-
when /^\d+$/ then value.to_i
|
110
|
-
when /^\d+\.\d+$/ then value.to_f
|
111
|
-
else value end
|
112
|
-
self[key.to_sym] = value
|
113
|
-
end
|
114
|
-
return self
|
115
|
-
end
|
116
|
-
|
117
|
-
# Simplier syntax for code such as params[:post] && params[:post][:title]
|
118
|
-
#
|
119
|
-
# @author Jakub Stastny aka Botanicus
|
120
|
-
# @since 0.0.3
|
121
|
-
# @param [Object] First argument is the key of the hash, the second one the key of the inner hash selected by the first key etc.
|
122
|
-
# @return [Object, nil] The value of the most inner hash if found or nil.
|
123
|
-
# @raise [ArgumentError] If you don't specify keys.
|
124
|
-
# @raise [IndexError] If you work with final result as with hash, so basically you are trying to call fetch method on string or whatever.
|
125
|
-
#
|
126
|
-
# @example
|
127
|
-
# {a: {b: 1}}.get(:a, :b) # => 1
|
128
|
-
# {a: {b: 1}}.get(:a, :b, :c) # => IndexError
|
129
|
-
# {a: {b: 1}}.get(:a, :c) # => nil
|
130
|
-
def get(*keys)
|
131
|
-
raise ArgumentError, "You must specify at least one key" if keys.empty?
|
132
|
-
keys.inject(self) do |object, key|
|
133
|
-
# Hash#fetch works similar as Hash#[], but [] method is
|
134
|
-
# defined for too many objects, also strings and even numbers
|
135
|
-
if object.respond_to?(:fetch)
|
136
|
-
begin
|
137
|
-
object.fetch(key)
|
138
|
-
# Hash#fetch raise IndexError if key doesn't exist
|
139
|
-
rescue IndexError
|
140
|
-
return nil
|
141
|
-
end
|
142
|
-
else
|
143
|
-
raise IndexError, "Object #{object.inspect} isn't hash-like collection"
|
144
|
-
end
|
145
|
-
end
|
146
|
-
end
|
147
|
-
|
148
|
-
##
|
149
|
-
# Create a hash with *only* key/value pairs in receiver and +allowed+
|
150
|
-
#
|
151
|
-
# { :one => 1, :two => 2, :three => 3 }.only(:one) #=> { :one => 1 }
|
152
|
-
#
|
153
|
-
# @param [Array[String, Symbol]] *allowed The hash keys to include.
|
154
|
-
#
|
155
|
-
# @return [Hash] A new hash with only the selected keys.
|
156
|
-
#
|
157
|
-
# @api public
|
158
|
-
def only(*allowed)
|
159
|
-
hash = {}
|
160
|
-
allowed.each {|k| hash[k] = self[k] if self.has_key?(k) }
|
161
|
-
hash
|
162
|
-
end
|
163
|
-
|
164
|
-
##
|
165
|
-
# Create a hash with all key/value pairs in receiver *except* +rejected+
|
166
|
-
#
|
167
|
-
# { :one => 1, :two => 2, :three => 3 }.except(:one)
|
168
|
-
# #=> { :two => 2, :three => 3 }
|
169
|
-
#
|
170
|
-
# @param [Array[String, Symbol]] *rejected The hash keys to exclude.
|
171
|
-
#
|
172
|
-
# @return [Hash] A new hash without the selected keys.
|
173
|
-
#
|
174
|
-
# @api public
|
175
|
-
def except(*rejected)
|
176
|
-
hash = self.dup
|
177
|
-
rejected.each {|k| hash.delete(k) }
|
178
|
-
hash
|
179
|
-
end
|
180
|
-
end
|
@@ -1,91 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
module Kernel
|
4
|
-
# @since 0.0.2
|
5
|
-
def metaclass
|
6
|
-
class << self
|
7
|
-
self
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
# os.home
|
12
|
-
def os
|
13
|
-
@os ||= OS.parse
|
14
|
-
end
|
15
|
-
|
16
|
-
# @since 0.0.1
|
17
|
-
# @example
|
18
|
-
# try_require_gem "term/ansicolor", "term-ansicolor"
|
19
|
-
# @param [String] library Library to require.
|
20
|
-
# @param [String, @optional] gemname Name of gem which contains required library. Will be used for displaying message.
|
21
|
-
# @return [Boolean] True if require was successful, false otherwise.
|
22
|
-
def try_require_gem(library, gemname = library, options = Hash.new)
|
23
|
-
gemname, options = library, gemname if gemname.is_a?(Hash) && options.empty?
|
24
|
-
try_require_gem!(library, gemname, options)
|
25
|
-
rescue LoadError
|
26
|
-
return false
|
27
|
-
end
|
28
|
-
|
29
|
-
# @since 0.0.3
|
30
|
-
def try_require_gem!(library, gemname = library, options = Hash.new)
|
31
|
-
gemname, options = library, gemname if gemname.is_a?(Hash) && options.empty?
|
32
|
-
require library
|
33
|
-
rescue LoadError => exception
|
34
|
-
message = "Gem #{gemname} isn't installed. Run sudo gem install #{gemname}. (#{exception.inspect})"
|
35
|
-
logger = Rango.logger.method(options[:level] || :error)
|
36
|
-
callable = defined?(Rango.logger) ? logger : method(:puts)
|
37
|
-
callable.call(message)
|
38
|
-
raise exception
|
39
|
-
end
|
40
|
-
|
41
|
-
# @since 0.0.3
|
42
|
-
def require_gem_or_exit(library, gemname = library, options = Hash.new)
|
43
|
-
gemname, options = library, gemname if gemname.is_a?(Hash) && options.empty?
|
44
|
-
try_require_gem!(library, gemname, options)
|
45
|
-
rescue LoadError
|
46
|
-
exit 1
|
47
|
-
end
|
48
|
-
|
49
|
-
# @since 0.0.3
|
50
|
-
def try_require(library)
|
51
|
-
require library
|
52
|
-
rescue LoadError
|
53
|
-
return false
|
54
|
-
end
|
55
|
-
|
56
|
-
def command(command)
|
57
|
-
puts command
|
58
|
-
puts %x[#{command}]
|
59
|
-
end
|
60
|
-
alias_method :sh, :command
|
61
|
-
alias_method :run, :command
|
62
|
-
|
63
|
-
def quiet(&block)
|
64
|
-
old_stdout = STDOUT.dup
|
65
|
-
STDOUT.reopen("/dev/null")
|
66
|
-
returned = block.call
|
67
|
-
STDOUT.reopen(old_stdout)
|
68
|
-
return returned
|
69
|
-
end
|
70
|
-
|
71
|
-
def quiet!(&block)
|
72
|
-
old_stderr = STDERR.dup
|
73
|
-
STDERR.reopen("/dev/null", "a")
|
74
|
-
returned = quiet(&block)
|
75
|
-
STDERR.reopen(old_stderr)
|
76
|
-
return returned
|
77
|
-
end
|
78
|
-
|
79
|
-
# for quick inspection
|
80
|
-
# @since 0.0.2
|
81
|
-
def puts_and_return(*args)
|
82
|
-
puts(*args)
|
83
|
-
return *args
|
84
|
-
end
|
85
|
-
|
86
|
-
# @since 0.0.2
|
87
|
-
def p_and_return(*args)
|
88
|
-
p(*args)
|
89
|
-
return *args
|
90
|
-
end
|
91
|
-
end
|
@@ -1,53 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
# Extends the module object with module and instance accessors for class attributes,
|
4
|
-
# just like the native attr* accessors for instance attributes.
|
5
|
-
#
|
6
|
-
# module AppConfiguration
|
7
|
-
# mattr_accessor :google_api_key
|
8
|
-
# self.google_api_key = "123456789"
|
9
|
-
#
|
10
|
-
# mattr_accessor :paypal_url
|
11
|
-
# self.paypal_url = "www.sandbox.paypal.com"
|
12
|
-
# end
|
13
|
-
#
|
14
|
-
# AppConfiguration.google_api_key = "overriding the api key!"
|
15
|
-
class Module
|
16
|
-
def mattr_reader(*syms)
|
17
|
-
syms.each do |sym|
|
18
|
-
next if sym.is_a?(Hash)
|
19
|
-
class_eval(<<-EOS, __FILE__, __LINE__)
|
20
|
-
unless defined? @@#{sym}
|
21
|
-
@@#{sym} = nil
|
22
|
-
end
|
23
|
-
|
24
|
-
def self.#{sym}
|
25
|
-
@@#{sym}
|
26
|
-
end
|
27
|
-
|
28
|
-
def #{sym}
|
29
|
-
@@#{sym}
|
30
|
-
end
|
31
|
-
EOS
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
def mattr_writer(*syms)
|
36
|
-
syms.each do |sym|
|
37
|
-
class_eval(<<-EOS, __FILE__, __LINE__)
|
38
|
-
unless defined? @@#{sym}
|
39
|
-
@@#{sym} = nil
|
40
|
-
end
|
41
|
-
|
42
|
-
def self.#{sym}=(obj)
|
43
|
-
@@#{sym} = obj
|
44
|
-
end
|
45
|
-
EOS
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
def mattr_accessor(*syms)
|
50
|
-
mattr_reader(*syms)
|
51
|
-
mattr_writer(*syms)
|
52
|
-
end
|
53
|
-
end
|
@@ -1,56 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
class Object
|
4
|
-
# *Unlike* that method however, a +NoMethodError+ exception will *not* be raised
|
5
|
-
# and +nil+ will be returned instead, if the receiving object is a +nil+ object or NilClass.
|
6
|
-
#
|
7
|
-
# Invokes the method identified by the symbol +method+, passing it any arguments
|
8
|
-
# and/or the block specified, just like the regular Ruby <tt>Object#send</tt> does.
|
9
|
-
#
|
10
|
-
# @author Botanicus
|
11
|
-
# @since 0.0.3
|
12
|
-
# @return [Object, nil] Return value of object.send(method) if object respond to method or nil
|
13
|
-
# @param [Symbol] Method which will be called on object if object respond to this method
|
14
|
-
# @param [Object, optional] Arguments for +method+ argument
|
15
|
-
# @yield [block, optional] Block for +method+ argument
|
16
|
-
# @example
|
17
|
-
# @post.try(:name) # instead @post && @post.name
|
18
|
-
# eBook.try(:find, 1)
|
19
|
-
# @post.try(:collect) { |p| p.name }
|
20
|
-
def try(method, *args, &block)
|
21
|
-
self.send(method, *args, &block) if self.respond_to?(method)
|
22
|
-
end
|
23
|
-
|
24
|
-
# The opposite of <tt>#nil?</tt>.
|
25
|
-
#
|
26
|
-
# @author Botanicus
|
27
|
-
# @since 0.0.3
|
28
|
-
# @return [true, false] True if self is nil, false otherwise
|
29
|
-
def not_nil?
|
30
|
-
not self.nil?
|
31
|
-
end
|
32
|
-
|
33
|
-
# Defines a instance method on class of the object.
|
34
|
-
#
|
35
|
-
# @author Botanicus
|
36
|
-
# @since 0.0.3
|
37
|
-
# @param [Symbol] Method name
|
38
|
-
# @param [Method, Proc, optional] +Method+ or +Proc+ which will be used as body of the method
|
39
|
-
# @yield [block] Block which will be used as body of the method
|
40
|
-
# @return [Object] First (and only) item of the array
|
41
|
-
# @see <tt>Module#define_singleton_method</tt> for define method on singleton class
|
42
|
-
# @example
|
43
|
-
# class Experiment
|
44
|
-
# def method_generator
|
45
|
-
# define_instance_method(:new_method) do |arg|
|
46
|
-
# puts "Method :new_method called with #{arg}"
|
47
|
-
# end
|
48
|
-
# end
|
49
|
-
# end
|
50
|
-
# Experiment.new.methods.include?(:new_method) # => false
|
51
|
-
# Experiment.new.method_generator
|
52
|
-
# Experiment.new.methods.include?(:new_method) # => true
|
53
|
-
def define_instance_method(*args, &block)
|
54
|
-
self.class.send(:define_method, *args, &block)
|
55
|
-
end
|
56
|
-
end
|