dh_easy-core 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.travis.yml +7 -0
- data/.yardopts +1 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/LICENSE +21 -0
- data/README.md +20 -0
- data/Rakefile +22 -0
- data/dh_easy-core.gemspec +50 -0
- data/doc/DhEasy.html +117 -0
- data/doc/DhEasy/Core.html +1590 -0
- data/doc/DhEasy/Core/Config.html +311 -0
- data/doc/DhEasy/Core/Exception.html +117 -0
- data/doc/DhEasy/Core/Exception/OutdatedError.html +135 -0
- data/doc/DhEasy/Core/Helper.html +117 -0
- data/doc/DhEasy/Core/Helper/Cookie.html +1070 -0
- data/doc/DhEasy/Core/Mock.html +282 -0
- data/doc/DhEasy/Core/Mock/FakeDb.html +3779 -0
- data/doc/DhEasy/Core/Mock/FakeExecutor.html +3289 -0
- data/doc/DhEasy/Core/Mock/FakeFinisher.html +160 -0
- data/doc/DhEasy/Core/Mock/FakeParser.html +160 -0
- data/doc/DhEasy/Core/Mock/FakeSeeder.html +160 -0
- data/doc/DhEasy/Core/Plugin.html +117 -0
- data/doc/DhEasy/Core/Plugin/CollectionVault.html +299 -0
- data/doc/DhEasy/Core/Plugin/ConfigBehavior.html +541 -0
- data/doc/DhEasy/Core/Plugin/ContextIntegrator.html +445 -0
- data/doc/DhEasy/Core/Plugin/Executor.html +259 -0
- data/doc/DhEasy/Core/Plugin/ExecutorBehavior.html +344 -0
- data/doc/DhEasy/Core/Plugin/Finisher.html +265 -0
- data/doc/DhEasy/Core/Plugin/FinisherBehavior.html +142 -0
- data/doc/DhEasy/Core/Plugin/InitializeHook.html +220 -0
- data/doc/DhEasy/Core/Plugin/Parser.html +270 -0
- data/doc/DhEasy/Core/Plugin/ParserBehavior.html +235 -0
- data/doc/DhEasy/Core/Plugin/Seeder.html +674 -0
- data/doc/DhEasy/Core/Plugin/SeederBehavior.html +142 -0
- data/doc/DhEasy/Core/SmartCollection.html +1087 -0
- data/doc/_index.html +364 -0
- data/doc/class_list.html +51 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +58 -0
- data/doc/css/style.css +496 -0
- data/doc/file.README.html +91 -0
- data/doc/file_list.html +56 -0
- data/doc/frames.html +17 -0
- data/doc/index.html +91 -0
- data/doc/js/app.js +303 -0
- data/doc/js/full_list.js +216 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +939 -0
- data/doc/top-level-namespace.html +110 -0
- data/lib/dh_easy/core.rb +257 -0
- data/lib/dh_easy/core/config.rb +27 -0
- data/lib/dh_easy/core/exception.rb +8 -0
- data/lib/dh_easy/core/exception/outdated_error.rb +9 -0
- data/lib/dh_easy/core/helper.rb +8 -0
- data/lib/dh_easy/core/helper/cookie.rb +209 -0
- data/lib/dh_easy/core/mock.rb +45 -0
- data/lib/dh_easy/core/mock/fake_db.rb +561 -0
- data/lib/dh_easy/core/mock/fake_executor.rb +373 -0
- data/lib/dh_easy/core/mock/fake_finisher.rb +28 -0
- data/lib/dh_easy/core/mock/fake_parser.rb +33 -0
- data/lib/dh_easy/core/mock/fake_seeder.rb +28 -0
- data/lib/dh_easy/core/plugin.rb +19 -0
- data/lib/dh_easy/core/plugin/collection_vault.rb +23 -0
- data/lib/dh_easy/core/plugin/config_behavior.rb +43 -0
- data/lib/dh_easy/core/plugin/context_integrator.rb +60 -0
- data/lib/dh_easy/core/plugin/executor.rb +19 -0
- data/lib/dh_easy/core/plugin/executor_behavior.rb +32 -0
- data/lib/dh_easy/core/plugin/finisher.rb +19 -0
- data/lib/dh_easy/core/plugin/finisher_behavior.rb +9 -0
- data/lib/dh_easy/core/plugin/initialize_hook.rb +17 -0
- data/lib/dh_easy/core/plugin/parser.rb +19 -0
- data/lib/dh_easy/core/plugin/parser_behavior.rb +17 -0
- data/lib/dh_easy/core/plugin/seeder.rb +44 -0
- data/lib/dh_easy/core/plugin/seeder_behavior.rb +9 -0
- data/lib/dh_easy/core/smart_collection.rb +236 -0
- data/lib/dh_easy/core/version.rb +6 -0
- metadata +249 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 819757d9eb449b3aba0b1ec43e775e9a42828c84eab29bdad06190dc1ef0802d
|
4
|
+
data.tar.gz: 9d9f06d17fca99cadbcf28f6152bc7724f753fa004f8883f87152c99045e9f4a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: bbe44694a4336370caa56b3ad4a4de2628e72b8c6bdd4b6d91e94d142bbcd9d5ba993440bc623aa54b40f58bbb9d23e905da64ce791d1eb6cbba323b55a021f5
|
7
|
+
data.tar.gz: f9763fa3e4840f704251f910d9046ba64041523dbaba1e5d81e1fec68a2677fe41cd007965b65ac0432597a28a0cde3d54aa42e755103f93ab4a8891a6731387
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/.yardopts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--no-private
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at perry@datahen.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2019 DataHen
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
[![Documentation](http://img.shields.io/badge/docs-rdoc.info-blue.svg)](http://rubydoc.org/gems/dh_easy-core/frames)
|
2
|
+
[![Gem Version](https://badge.fury.io/rb/dh_easy-core.svg)](http://github.com/DataHenOfficial/dh_easy-core/releases)
|
3
|
+
[![License](http://img.shields.io/badge/license-MIT-yellowgreen.svg)](#license)
|
4
|
+
|
5
|
+
# DhEasy core module
|
6
|
+
## Description
|
7
|
+
|
8
|
+
DhEasy core is part of DhEasy gem collection and allow advance DataHen features possible by function as a base for other gems.
|
9
|
+
|
10
|
+
Install gem:
|
11
|
+
```
|
12
|
+
gem install 'dh_easy-core'
|
13
|
+
```
|
14
|
+
|
15
|
+
Require gem:
|
16
|
+
```
|
17
|
+
require 'dh_easy/core'
|
18
|
+
```
|
19
|
+
|
20
|
+
Documentation can be found [here](http://rubydoc.org/gems/dh_easy-core/frames).
|
data/Rakefile
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'benchmark'
|
2
|
+
require 'bundler/gem_tasks'
|
3
|
+
require 'rake/testtask'
|
4
|
+
|
5
|
+
Rake::TestTask.new do |t|
|
6
|
+
t.libs = ['lib', 'test']
|
7
|
+
t.warning = false
|
8
|
+
t.verbose = false
|
9
|
+
t.test_files = FileList['./test/**/*_test.rb']
|
10
|
+
end
|
11
|
+
|
12
|
+
desc 'Benchmark another task execution | usage example: benchmark[my_task, param1, param2]'
|
13
|
+
task :benchmark, [:task] do |task, args|
|
14
|
+
task_name = args[:task]
|
15
|
+
if task_name.nil?
|
16
|
+
puts "Should select a task."
|
17
|
+
exit 1
|
18
|
+
end
|
19
|
+
puts Benchmark.measure{ Rake::Task[task_name].invoke *args.extras }
|
20
|
+
end
|
21
|
+
|
22
|
+
task default: :test
|
@@ -0,0 +1,50 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "dh_easy/core/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "dh_easy-core"
|
8
|
+
spec.version = DhEasy::Core::VERSION
|
9
|
+
spec.authors = ["Eduardo Rosales"]
|
10
|
+
spec.email = ["eduardo@datahen.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{DataHen Easy toolkit core module}
|
13
|
+
spec.description = %q{DataHen Easy toolkit core module to support other complex modules.}
|
14
|
+
spec.homepage = "https://datahen.com"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# spec.cert_chain = ['certs/dh_easy.pem']
|
18
|
+
# spec.signing_key = File.expand_path("~/.ssh/gems/gem-private_dh_easy.pem") if $0 =~ /gem\z/
|
19
|
+
|
20
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
21
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
22
|
+
if spec.respond_to?(:metadata)
|
23
|
+
# spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
24
|
+
|
25
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
26
|
+
spec.metadata["source_code_uri"] = "https://github.com/DataHenOfficial/dh_easy-core"
|
27
|
+
# spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
|
28
|
+
else
|
29
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
30
|
+
"public gem pushes."
|
31
|
+
end
|
32
|
+
|
33
|
+
# Specify which files should be added to the gem when it is released.
|
34
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
35
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
36
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
37
|
+
end
|
38
|
+
spec.require_paths = ["lib"]
|
39
|
+
spec.required_ruby_version = '>= 2.2.2'
|
40
|
+
|
41
|
+
spec.add_dependency 'datahen', '~> 0.9'
|
42
|
+
spec.add_dependency 'faker', '~> 1'
|
43
|
+
spec.add_development_dependency 'bundler', '>= 1'
|
44
|
+
spec.add_development_dependency 'rake', '~> 10'
|
45
|
+
spec.add_development_dependency 'minitest', '~> 5'
|
46
|
+
spec.add_development_dependency 'simplecov', '~> 0'
|
47
|
+
spec.add_development_dependency 'simplecov-console', '~> 0'
|
48
|
+
spec.add_development_dependency 'timecop', '~> 0'
|
49
|
+
spec.add_development_dependency 'byebug', '>= 0'
|
50
|
+
end
|
data/doc/DhEasy.html
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
Module: DhEasy
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.20
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
pathId = "DhEasy";
|
19
|
+
relpath = '';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
|
23
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
24
|
+
|
25
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
26
|
+
|
27
|
+
|
28
|
+
</head>
|
29
|
+
<body>
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="class_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
38
|
+
|
39
|
+
<a href="_index.html">Index (D)</a> »
|
40
|
+
|
41
|
+
|
42
|
+
<span class="title">DhEasy</span>
|
43
|
+
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<div id="search">
|
47
|
+
|
48
|
+
<a class="full_list_link" id="class_list_link"
|
49
|
+
href="class_list.html">
|
50
|
+
|
51
|
+
<svg width="24" height="24">
|
52
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
54
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
55
|
+
</svg>
|
56
|
+
</a>
|
57
|
+
|
58
|
+
</div>
|
59
|
+
<div class="clear"></div>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<div id="content"><h1>Module: DhEasy
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<dl>
|
80
|
+
<dt>Defined in:</dt>
|
81
|
+
<dd>lib/dh_easy/core.rb<span class="defines">,<br />
|
82
|
+
lib/dh_easy/core/mock.rb,<br /> lib/dh_easy/core/config.rb,<br /> lib/dh_easy/core/helper.rb,<br /> lib/dh_easy/core/plugin.rb,<br /> lib/dh_easy/core/version.rb,<br /> lib/dh_easy/core/exception.rb,<br /> lib/dh_easy/core/mock/fake_db.rb,<br /> lib/dh_easy/core/helper/cookie.rb,<br /> lib/dh_easy/core/plugin/parser.rb,<br /> lib/dh_easy/core/plugin/seeder.rb,<br /> lib/dh_easy/core/plugin/executor.rb,<br /> lib/dh_easy/core/plugin/finisher.rb,<br /> lib/dh_easy/core/mock/fake_parser.rb,<br /> lib/dh_easy/core/mock/fake_seeder.rb,<br /> lib/dh_easy/core/smart_collection.rb,<br /> lib/dh_easy/core/mock/fake_executor.rb,<br /> lib/dh_easy/core/mock/fake_finisher.rb,<br /> lib/dh_easy/core/plugin/config_behavior.rb,<br /> lib/dh_easy/core/plugin/initialize_hook.rb,<br /> lib/dh_easy/core/plugin/parser_behavior.rb,<br /> lib/dh_easy/core/plugin/seeder_behavior.rb,<br /> lib/dh_easy/core/plugin/collection_vault.rb,<br /> lib/dh_easy/core/exception/outdated_error.rb,<br /> lib/dh_easy/core/plugin/executor_behavior.rb,<br /> lib/dh_easy/core/plugin/finisher_behavior.rb,<br /> lib/dh_easy/core/plugin/context_integrator.rb</span>
|
83
|
+
</dd>
|
84
|
+
</dl>
|
85
|
+
|
86
|
+
</div>
|
87
|
+
|
88
|
+
<h2>Defined Under Namespace</h2>
|
89
|
+
<p class="children">
|
90
|
+
|
91
|
+
|
92
|
+
<strong class="modules">Modules:</strong> <span class='object_link'><a href="DhEasy/Core.html" title="DhEasy::Core (module)">Core</a></span>
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
</p>
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
</div>
|
108
|
+
|
109
|
+
<div id="footer">
|
110
|
+
Generated on Wed Dec 4 23:00:02 2019 by
|
111
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
112
|
+
0.9.20 (ruby-2.5.3).
|
113
|
+
</div>
|
114
|
+
|
115
|
+
</div>
|
116
|
+
</body>
|
117
|
+
</html>
|
@@ -0,0 +1,1590 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
Module: DhEasy::Core
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.20
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
pathId = "DhEasy::Core";
|
19
|
+
relpath = '../';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
|
23
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
24
|
+
|
25
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
26
|
+
|
27
|
+
|
28
|
+
</head>
|
29
|
+
<body>
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="../class_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
38
|
+
|
39
|
+
<a href="../_index.html">Index (C)</a> »
|
40
|
+
<span class='title'><span class='object_link'><a href="../DhEasy.html" title="DhEasy (module)">DhEasy</a></span></span>
|
41
|
+
»
|
42
|
+
<span class="title">Core</span>
|
43
|
+
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<div id="search">
|
47
|
+
|
48
|
+
<a class="full_list_link" id="class_list_link"
|
49
|
+
href="../class_list.html">
|
50
|
+
|
51
|
+
<svg width="24" height="24">
|
52
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
54
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
55
|
+
</svg>
|
56
|
+
</a>
|
57
|
+
|
58
|
+
</div>
|
59
|
+
<div class="clear"></div>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<div id="content"><h1>Module: DhEasy::Core
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<dl>
|
80
|
+
<dt>Defined in:</dt>
|
81
|
+
<dd>lib/dh_easy/core.rb<span class="defines">,<br />
|
82
|
+
lib/dh_easy/core/mock.rb,<br /> lib/dh_easy/core/config.rb,<br /> lib/dh_easy/core/helper.rb,<br /> lib/dh_easy/core/plugin.rb,<br /> lib/dh_easy/core/version.rb,<br /> lib/dh_easy/core/exception.rb,<br /> lib/dh_easy/core/mock/fake_db.rb,<br /> lib/dh_easy/core/helper/cookie.rb,<br /> lib/dh_easy/core/plugin/parser.rb,<br /> lib/dh_easy/core/plugin/seeder.rb,<br /> lib/dh_easy/core/plugin/executor.rb,<br /> lib/dh_easy/core/plugin/finisher.rb,<br /> lib/dh_easy/core/mock/fake_parser.rb,<br /> lib/dh_easy/core/mock/fake_seeder.rb,<br /> lib/dh_easy/core/smart_collection.rb,<br /> lib/dh_easy/core/mock/fake_executor.rb,<br /> lib/dh_easy/core/mock/fake_finisher.rb,<br /> lib/dh_easy/core/plugin/config_behavior.rb,<br /> lib/dh_easy/core/plugin/initialize_hook.rb,<br /> lib/dh_easy/core/plugin/parser_behavior.rb,<br /> lib/dh_easy/core/plugin/seeder_behavior.rb,<br /> lib/dh_easy/core/plugin/collection_vault.rb,<br /> lib/dh_easy/core/exception/outdated_error.rb,<br /> lib/dh_easy/core/plugin/executor_behavior.rb,<br /> lib/dh_easy/core/plugin/finisher_behavior.rb,<br /> lib/dh_easy/core/plugin/context_integrator.rb</span>
|
83
|
+
</dd>
|
84
|
+
</dl>
|
85
|
+
|
86
|
+
</div>
|
87
|
+
|
88
|
+
<h2>Defined Under Namespace</h2>
|
89
|
+
<p class="children">
|
90
|
+
|
91
|
+
|
92
|
+
<strong class="modules">Modules:</strong> <span class='object_link'><a href="Core/Exception.html" title="DhEasy::Core::Exception (module)">Exception</a></span>, <span class='object_link'><a href="Core/Helper.html" title="DhEasy::Core::Helper (module)">Helper</a></span>, <span class='object_link'><a href="Core/Mock.html" title="DhEasy::Core::Mock (module)">Mock</a></span>, <span class='object_link'><a href="Core/Plugin.html" title="DhEasy::Core::Plugin (module)">Plugin</a></span>
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Core/Config.html" title="DhEasy::Core::Config (class)">Config</a></span>, <span class='object_link'><a href="Core/SmartCollection.html" title="DhEasy::Core::SmartCollection (class)">SmartCollection</a></span>
|
97
|
+
|
98
|
+
|
99
|
+
</p>
|
100
|
+
|
101
|
+
|
102
|
+
<h2>
|
103
|
+
Constant Summary
|
104
|
+
<small><a href="#" class="constants_summary_toggle">collapse</a></small>
|
105
|
+
</h2>
|
106
|
+
|
107
|
+
<dl class="constants">
|
108
|
+
|
109
|
+
<dt id="VERSION-constant" class="">VERSION =
|
110
|
+
<div class="docstring">
|
111
|
+
<div class="discussion">
|
112
|
+
|
113
|
+
<p>Gem version</p>
|
114
|
+
|
115
|
+
|
116
|
+
</div>
|
117
|
+
</div>
|
118
|
+
<div class="tags">
|
119
|
+
|
120
|
+
|
121
|
+
</div>
|
122
|
+
</dt>
|
123
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>0.2.2</span><span class='tstring_end'>"</span></span></pre></dd>
|
124
|
+
|
125
|
+
</dl>
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
<h2>
|
136
|
+
Class Method Summary
|
137
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
138
|
+
</h2>
|
139
|
+
|
140
|
+
<ul class="summary">
|
141
|
+
|
142
|
+
<li class="public ">
|
143
|
+
<span class="summary_signature">
|
144
|
+
|
145
|
+
<a href="#all_scripts-class_method" title="all_scripts (class method)">.<strong>all_scripts</strong>(dir, opts = {}) {|path| ... } ⇒ Object </a>
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
</span>
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
<span class="summary_desc"><div class='inline'>
|
160
|
+
<p>Execute an action for all scripts within a directory.</p>
|
161
|
+
</div></span>
|
162
|
+
|
163
|
+
</li>
|
164
|
+
|
165
|
+
|
166
|
+
<li class="public ">
|
167
|
+
<span class="summary_signature">
|
168
|
+
|
169
|
+
<a href="#analyze_compatibility-class_method" title="analyze_compatibility (class method)">.<strong>analyze_compatibility</strong>(origin, fragment) ⇒ Hash </a>
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
</span>
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
<span class="summary_desc"><div class='inline'>
|
184
|
+
<p>Generate a compatibility report from a origin and a fragment as a hash.</p>
|
185
|
+
</div></span>
|
186
|
+
|
187
|
+
</li>
|
188
|
+
|
189
|
+
|
190
|
+
<li class="public ">
|
191
|
+
<span class="summary_signature">
|
192
|
+
|
193
|
+
<a href="#deep_clone-class_method" title="deep_clone (class method)">.<strong>deep_clone</strong>(hash, should_clone = false) ⇒ Hash </a>
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
</span>
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
<span class="summary_desc"><div class='inline'>
|
208
|
+
<p>Deep clone a hash while keeping it's values object references.</p>
|
209
|
+
</div></span>
|
210
|
+
|
211
|
+
</li>
|
212
|
+
|
213
|
+
|
214
|
+
<li class="public ">
|
215
|
+
<span class="summary_signature">
|
216
|
+
|
217
|
+
<a href="#deep_stringify_keys-class_method" title="deep_stringify_keys (class method)">.<strong>deep_stringify_keys</strong>(hash, should_clone = true) ⇒ Hash </a>
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
</span>
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
<span class="summary_desc"><div class='inline'>
|
232
|
+
<p>Deep stringify keys from a hash.</p>
|
233
|
+
</div></span>
|
234
|
+
|
235
|
+
</li>
|
236
|
+
|
237
|
+
|
238
|
+
<li class="public ">
|
239
|
+
<span class="summary_signature">
|
240
|
+
|
241
|
+
<a href="#deep_stringify_keys!-class_method" title="deep_stringify_keys! (class method)">.<strong>deep_stringify_keys!</strong>(hash) ⇒ Hash </a>
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
</span>
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
<span class="summary_desc"><div class='inline'>
|
256
|
+
<p>Deep stringify all keys on hash object.</p>
|
257
|
+
</div></span>
|
258
|
+
|
259
|
+
</li>
|
260
|
+
|
261
|
+
|
262
|
+
<li class="public ">
|
263
|
+
<span class="summary_signature">
|
264
|
+
|
265
|
+
<a href="#expose_to-class_method" title="expose_to (class method)">.<strong>expose_to</strong>(object, env) ⇒ Object </a>
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
</span>
|
270
|
+
|
271
|
+
|
272
|
+
|
273
|
+
|
274
|
+
|
275
|
+
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
<span class="summary_desc"><div class='inline'>
|
280
|
+
<p>Expose an environment into an object instance as methods.</p>
|
281
|
+
</div></span>
|
282
|
+
|
283
|
+
</li>
|
284
|
+
|
285
|
+
|
286
|
+
<li class="public ">
|
287
|
+
<span class="summary_signature">
|
288
|
+
|
289
|
+
<a href="#instance_methods_from-class_method" title="instance_methods_from (class method)">.<strong>instance_methods_from</strong>(object, class_only = false) ⇒ Array </a>
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
</span>
|
294
|
+
|
295
|
+
|
296
|
+
|
297
|
+
|
298
|
+
|
299
|
+
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
<span class="summary_desc"><div class='inline'>
|
304
|
+
<p>Retrieve instance methods from an object.</p>
|
305
|
+
</div></span>
|
306
|
+
|
307
|
+
</li>
|
308
|
+
|
309
|
+
|
310
|
+
<li class="public ">
|
311
|
+
<span class="summary_signature">
|
312
|
+
|
313
|
+
<a href="#mock_instance_methods-class_method" title="mock_instance_methods (class method)">.<strong>mock_instance_methods</strong>(origin, target) ⇒ Object </a>
|
314
|
+
|
315
|
+
|
316
|
+
|
317
|
+
</span>
|
318
|
+
|
319
|
+
|
320
|
+
|
321
|
+
|
322
|
+
|
323
|
+
|
324
|
+
|
325
|
+
|
326
|
+
|
327
|
+
<span class="summary_desc"><div class='inline'>
|
328
|
+
<p>Mock instances methods from the origin into target object.</p>
|
329
|
+
</div></span>
|
330
|
+
|
331
|
+
</li>
|
332
|
+
|
333
|
+
|
334
|
+
<li class="public ">
|
335
|
+
<span class="summary_signature">
|
336
|
+
|
337
|
+
<a href="#require_all-class_method" title="require_all (class method)">.<strong>require_all</strong>(dir, opts = {}) ⇒ Object </a>
|
338
|
+
|
339
|
+
|
340
|
+
|
341
|
+
</span>
|
342
|
+
|
343
|
+
|
344
|
+
|
345
|
+
|
346
|
+
|
347
|
+
|
348
|
+
|
349
|
+
|
350
|
+
|
351
|
+
<span class="summary_desc"><div class='inline'>
|
352
|
+
<p>Require all scripts within a directory.</p>
|
353
|
+
</div></span>
|
354
|
+
|
355
|
+
</li>
|
356
|
+
|
357
|
+
|
358
|
+
<li class="public ">
|
359
|
+
<span class="summary_signature">
|
360
|
+
|
361
|
+
<a href="#require_relative_all-class_method" title="require_relative_all (class method)">.<strong>require_relative_all</strong>(dir, opts = {}) ⇒ Object </a>
|
362
|
+
|
363
|
+
|
364
|
+
|
365
|
+
</span>
|
366
|
+
|
367
|
+
|
368
|
+
|
369
|
+
|
370
|
+
|
371
|
+
|
372
|
+
|
373
|
+
|
374
|
+
|
375
|
+
<span class="summary_desc"><div class='inline'>
|
376
|
+
<p>Require all relative scripts paths within a directory.</p>
|
377
|
+
</div></span>
|
378
|
+
|
379
|
+
</li>
|
380
|
+
|
381
|
+
|
382
|
+
</ul>
|
383
|
+
|
384
|
+
|
385
|
+
|
386
|
+
|
387
|
+
<div id="class_method_details" class="method_details_list">
|
388
|
+
<h2>Class Method Details</h2>
|
389
|
+
|
390
|
+
|
391
|
+
<div class="method_details first">
|
392
|
+
<h3 class="signature first" id="all_scripts-class_method">
|
393
|
+
|
394
|
+
.<strong>all_scripts</strong>(dir, opts = {}) {|path| ... } ⇒ <tt>Object</tt>
|
395
|
+
|
396
|
+
|
397
|
+
|
398
|
+
|
399
|
+
|
400
|
+
</h3><div class="docstring">
|
401
|
+
<div class="discussion">
|
402
|
+
|
403
|
+
<p>Execute an action for all scripts within a directory.</p>
|
404
|
+
|
405
|
+
|
406
|
+
</div>
|
407
|
+
</div>
|
408
|
+
<div class="tags">
|
409
|
+
<p class="tag_title">Parameters:</p>
|
410
|
+
<ul class="param">
|
411
|
+
|
412
|
+
<li>
|
413
|
+
|
414
|
+
<span class='name'>dir</span>
|
415
|
+
|
416
|
+
|
417
|
+
<span class='type'>(<tt>String</tt>)</span>
|
418
|
+
|
419
|
+
|
420
|
+
|
421
|
+
—
|
422
|
+
<div class='inline'>
|
423
|
+
<p>Directory containing `.rb` scripts.</p>
|
424
|
+
</div>
|
425
|
+
|
426
|
+
</li>
|
427
|
+
|
428
|
+
<li>
|
429
|
+
|
430
|
+
<span class='name'>opts</span>
|
431
|
+
|
432
|
+
|
433
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
434
|
+
|
435
|
+
|
436
|
+
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
437
|
+
|
438
|
+
|
439
|
+
—
|
440
|
+
<div class='inline'>
|
441
|
+
<p>({}) Configuration options.</p>
|
442
|
+
</div>
|
443
|
+
|
444
|
+
</li>
|
445
|
+
|
446
|
+
</ul>
|
447
|
+
|
448
|
+
|
449
|
+
|
450
|
+
|
451
|
+
|
452
|
+
|
453
|
+
<p class="tag_title">Options Hash (<tt>opts</tt>):</p>
|
454
|
+
<ul class="option">
|
455
|
+
|
456
|
+
<li>
|
457
|
+
<span class="name">:except</span>
|
458
|
+
<span class="type">(<tt>Array</tt>)</span>
|
459
|
+
<span class="default">
|
460
|
+
|
461
|
+
— default:
|
462
|
+
<tt>nil</tt>
|
463
|
+
|
464
|
+
</span>
|
465
|
+
|
466
|
+
— <div class='inline'>
|
467
|
+
<p>Literal file collection excluded from process.</p>
|
468
|
+
</div>
|
469
|
+
|
470
|
+
</li>
|
471
|
+
|
472
|
+
</ul>
|
473
|
+
|
474
|
+
|
475
|
+
<p class="tag_title">Yield Parameters:</p>
|
476
|
+
<ul class="yieldparam">
|
477
|
+
|
478
|
+
<li>
|
479
|
+
|
480
|
+
<span class='name'>path</span>
|
481
|
+
|
482
|
+
|
483
|
+
<span class='type'>(<tt>String</tt>)</span>
|
484
|
+
|
485
|
+
|
486
|
+
|
487
|
+
—
|
488
|
+
<div class='inline'>
|
489
|
+
<p>Script file path.</p>
|
490
|
+
</div>
|
491
|
+
|
492
|
+
</li>
|
493
|
+
|
494
|
+
</ul>
|
495
|
+
|
496
|
+
</div><table class="source_code">
|
497
|
+
<tr>
|
498
|
+
<td>
|
499
|
+
<pre class="lines">
|
500
|
+
|
501
|
+
|
502
|
+
30
|
503
|
+
31
|
504
|
+
32
|
505
|
+
33
|
506
|
+
34
|
507
|
+
35</pre>
|
508
|
+
</td>
|
509
|
+
<td>
|
510
|
+
<pre class="code"><span class="info file"># File 'lib/dh_easy/core.rb', line 30</span>
|
511
|
+
|
512
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_all_scripts'>all_scripts</span> <span class='id identifier rubyid_dir'>dir</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span>
|
513
|
+
<span class='id identifier rubyid_excluded_files'>excluded_files</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:except</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_f'>f</span><span class='op'>|</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='id identifier rubyid_dir'>dir</span><span class='comma'>,</span> <span class='id identifier rubyid_f'>f</span><span class='rparen'>)</span><span class='rbrace'>}</span>
|
514
|
+
<span class='id identifier rubyid_files'>files</span> <span class='op'>=</span> <span class='const'>Dir</span><span class='lbracket'>[</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='id identifier rubyid_dir'>dir</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>*.rb</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='rbracket'>]</span> <span class='op'>-</span> <span class='id identifier rubyid_excluded_files'>excluded_files</span>
|
515
|
+
<span class='id identifier rubyid_block'>block</span> <span class='op'>||=</span> <span class='id identifier rubyid_proc'>proc</span><span class='lbrace'>{</span><span class='rbrace'>}</span>
|
516
|
+
<span class='id identifier rubyid_files'>files</span><span class='period'>.</span><span class='id identifier rubyid_sort'>sort</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span>
|
517
|
+
<span class='kw'>end</span></pre>
|
518
|
+
</td>
|
519
|
+
</tr>
|
520
|
+
</table>
|
521
|
+
</div>
|
522
|
+
|
523
|
+
<div class="method_details ">
|
524
|
+
<h3 class="signature " id="analyze_compatibility-class_method">
|
525
|
+
|
526
|
+
.<strong>analyze_compatibility</strong>(origin, fragment) ⇒ <tt>Hash</tt>
|
527
|
+
|
528
|
+
|
529
|
+
|
530
|
+
|
531
|
+
|
532
|
+
</h3><div class="docstring">
|
533
|
+
<div class="discussion">
|
534
|
+
|
535
|
+
<p>Generate a compatibility report from a origin and a fragment as a hash.</p>
|
536
|
+
|
537
|
+
|
538
|
+
</div>
|
539
|
+
</div>
|
540
|
+
<div class="tags">
|
541
|
+
|
542
|
+
<div class="examples">
|
543
|
+
<p class="tag_title">Examples:</p>
|
544
|
+
|
545
|
+
|
546
|
+
<p class="example_title"><div class='inline'>
|
547
|
+
<p>Analyze when uncompatible `fragment` because of `origin` missing fields.</p>
|
548
|
+
</div></p>
|
549
|
+
|
550
|
+
<pre class="example code"><code><span class='const'><span class='object_link'><a href="../DhEasy.html" title="DhEasy (module)">DhEasy</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="DhEasy::Core (module)">Core</a></span></span><span class='period'>.</span><span class='id identifier rubyid_analyze_compatibility'>analyze_compatibility</span> <span class='lbracket'>[</span><span class='int'>1</span><span class='comma'>,</span><span class='int'>2</span><span class='comma'>,</span><span class='int'>3</span><span class='comma'>,</span><span class='int'>4</span><span class='comma'>,</span><span class='int'>5</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='int'>1</span><span class='comma'>,</span><span class='int'>2</span><span class='comma'>,</span><span class='int'>6</span><span class='rbracket'>]</span>
|
551
|
+
<span class='comment'># => {missing: [6], new: [3,4,5], is_compatible: false}</span></code></pre>
|
552
|
+
|
553
|
+
|
554
|
+
<p class="example_title"><div class='inline'>
|
555
|
+
<p>Analyze when compatible.</p>
|
556
|
+
</div></p>
|
557
|
+
|
558
|
+
<pre class="example code"><code><span class='const'><span class='object_link'><a href="../DhEasy.html" title="DhEasy (module)">DhEasy</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="DhEasy::Core (module)">Core</a></span></span><span class='period'>.</span><span class='id identifier rubyid_analyze_compatibility'>analyze_compatibility</span> <span class='lbracket'>[</span><span class='int'>1</span><span class='comma'>,</span><span class='int'>2</span><span class='comma'>,</span><span class='int'>3</span><span class='comma'>,</span><span class='int'>4</span><span class='comma'>,</span><span class='int'>5</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='int'>1</span><span class='comma'>,</span><span class='int'>2</span><span class='comma'>,</span><span class='int'>3</span><span class='rbracket'>]</span>
|
559
|
+
<span class='comment'># => {missing: [], new: [4,5], is_compatible: true}</span></code></pre>
|
560
|
+
|
561
|
+
</div>
|
562
|
+
<p class="tag_title">Parameters:</p>
|
563
|
+
<ul class="param">
|
564
|
+
|
565
|
+
<li>
|
566
|
+
|
567
|
+
<span class='name'>origin</span>
|
568
|
+
|
569
|
+
|
570
|
+
<span class='type'>(<tt>Array</tt>)</span>
|
571
|
+
|
572
|
+
|
573
|
+
|
574
|
+
—
|
575
|
+
<div class='inline'>
|
576
|
+
<p>Item collection to represent the universe.</p>
|
577
|
+
</div>
|
578
|
+
|
579
|
+
</li>
|
580
|
+
|
581
|
+
<li>
|
582
|
+
|
583
|
+
<span class='name'>fragment</span>
|
584
|
+
|
585
|
+
|
586
|
+
<span class='type'>(<tt>Array</tt>)</span>
|
587
|
+
|
588
|
+
|
589
|
+
|
590
|
+
—
|
591
|
+
<div class='inline'>
|
592
|
+
<p>Item collection to compare againt <code>origin</code>.</p>
|
593
|
+
</div>
|
594
|
+
|
595
|
+
</li>
|
596
|
+
|
597
|
+
</ul>
|
598
|
+
|
599
|
+
<p class="tag_title">Returns:</p>
|
600
|
+
<ul class="return">
|
601
|
+
|
602
|
+
<li>
|
603
|
+
|
604
|
+
|
605
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
606
|
+
|
607
|
+
|
608
|
+
|
609
|
+
—
|
610
|
+
<div class='inline'><ul><li>
|
611
|
+
<p>`:missing [Array]` (`[]`) Methods on `fragment` only.</p>
|
612
|
+
</li><li>
|
613
|
+
<p>`:new [Array]` (`[]`) Methods on `origin` only.</p>
|
614
|
+
</li><li>
|
615
|
+
<p>`:is_compatible [Boolean]` true when all `fragment`'s methods are
|
616
|
+
present on `origin`.</p>
|
617
|
+
</li></ul>
|
618
|
+
</div>
|
619
|
+
|
620
|
+
</li>
|
621
|
+
|
622
|
+
</ul>
|
623
|
+
|
624
|
+
</div><table class="source_code">
|
625
|
+
<tr>
|
626
|
+
<td>
|
627
|
+
<pre class="lines">
|
628
|
+
|
629
|
+
|
630
|
+
197
|
631
|
+
198
|
632
|
+
199
|
633
|
+
200
|
634
|
+
201
|
635
|
+
202
|
636
|
+
203
|
637
|
+
204</pre>
|
638
|
+
</td>
|
639
|
+
<td>
|
640
|
+
<pre class="code"><span class="info file"># File 'lib/dh_easy/core.rb', line 197</span>
|
641
|
+
|
642
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_analyze_compatibility'>analyze_compatibility</span> <span class='id identifier rubyid_origin'>origin</span><span class='comma'>,</span> <span class='id identifier rubyid_fragment'>fragment</span>
|
643
|
+
<span class='id identifier rubyid_intersection'>intersection</span> <span class='op'>=</span> <span class='id identifier rubyid_origin'>origin</span> <span class='op'>&</span> <span class='id identifier rubyid_fragment'>fragment</span>
|
644
|
+
<span class='lbrace'>{</span>
|
645
|
+
<span class='label'>missing:</span> <span class='id identifier rubyid_fragment'>fragment</span> <span class='op'>-</span> <span class='id identifier rubyid_intersection'>intersection</span><span class='comma'>,</span>
|
646
|
+
<span class='label'>new:</span> <span class='id identifier rubyid_origin'>origin</span> <span class='op'>-</span> <span class='id identifier rubyid_intersection'>intersection</span><span class='comma'>,</span>
|
647
|
+
<span class='label'>is_compatible:</span> <span class='lparen'>(</span><span class='id identifier rubyid_intersection'>intersection</span><span class='period'>.</span><span class='id identifier rubyid_count'>count</span> <span class='op'>==</span> <span class='id identifier rubyid_fragment'>fragment</span><span class='period'>.</span><span class='id identifier rubyid_count'>count</span><span class='rparen'>)</span>
|
648
|
+
<span class='rbrace'>}</span>
|
649
|
+
<span class='kw'>end</span></pre>
|
650
|
+
</td>
|
651
|
+
</tr>
|
652
|
+
</table>
|
653
|
+
</div>
|
654
|
+
|
655
|
+
<div class="method_details ">
|
656
|
+
<h3 class="signature " id="deep_clone-class_method">
|
657
|
+
|
658
|
+
.<strong>deep_clone</strong>(hash, should_clone = false) ⇒ <tt>Hash</tt>
|
659
|
+
|
660
|
+
|
661
|
+
|
662
|
+
|
663
|
+
|
664
|
+
</h3><div class="docstring">
|
665
|
+
<div class="discussion">
|
666
|
+
|
667
|
+
<p>Deep clone a hash while keeping it's values object references.</p>
|
668
|
+
|
669
|
+
|
670
|
+
</div>
|
671
|
+
</div>
|
672
|
+
<div class="tags">
|
673
|
+
<p class="tag_title">Parameters:</p>
|
674
|
+
<ul class="param">
|
675
|
+
|
676
|
+
<li>
|
677
|
+
|
678
|
+
<span class='name'>hash</span>
|
679
|
+
|
680
|
+
|
681
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
682
|
+
|
683
|
+
|
684
|
+
|
685
|
+
—
|
686
|
+
<div class='inline'>
|
687
|
+
<p>Hash to clone.</p>
|
688
|
+
</div>
|
689
|
+
|
690
|
+
</li>
|
691
|
+
|
692
|
+
<li>
|
693
|
+
|
694
|
+
<span class='name'>should_clone</span>
|
695
|
+
|
696
|
+
|
697
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
698
|
+
|
699
|
+
|
700
|
+
<em class="default">(defaults to: <tt>false</tt>)</em>
|
701
|
+
|
702
|
+
|
703
|
+
—
|
704
|
+
<div class='inline'>
|
705
|
+
<p>(false) Clone values when true.</p>
|
706
|
+
</div>
|
707
|
+
|
708
|
+
</li>
|
709
|
+
|
710
|
+
</ul>
|
711
|
+
|
712
|
+
<p class="tag_title">Returns:</p>
|
713
|
+
<ul class="return">
|
714
|
+
|
715
|
+
<li>
|
716
|
+
|
717
|
+
|
718
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
719
|
+
|
720
|
+
|
721
|
+
|
722
|
+
—
|
723
|
+
<div class='inline'>
|
724
|
+
<p>Hash clone.</p>
|
725
|
+
</div>
|
726
|
+
|
727
|
+
</li>
|
728
|
+
|
729
|
+
</ul>
|
730
|
+
|
731
|
+
</div><table class="source_code">
|
732
|
+
<tr>
|
733
|
+
<td>
|
734
|
+
<pre class="lines">
|
735
|
+
|
736
|
+
|
737
|
+
247
|
738
|
+
248
|
739
|
+
249
|
740
|
+
250
|
741
|
+
251
|
742
|
+
252
|
743
|
+
253
|
744
|
+
254</pre>
|
745
|
+
</td>
|
746
|
+
<td>
|
747
|
+
<pre class="code"><span class="info file"># File 'lib/dh_easy/core.rb', line 247</span>
|
748
|
+
|
749
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_deep_clone'>deep_clone</span> <span class='id identifier rubyid_hash'>hash</span><span class='comma'>,</span> <span class='id identifier rubyid_should_clone'>should_clone</span> <span class='op'>=</span> <span class='kw'>false</span>
|
750
|
+
<span class='id identifier rubyid_target'>target</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
751
|
+
<span class='id identifier rubyid_hash'>hash</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='op'>|</span>
|
752
|
+
<span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Hash</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_deep_clone'>deep_clone</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='id identifier rubyid_should_clone'>should_clone</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='lparen'>(</span><span class='id identifier rubyid_should_clone'>should_clone</span> <span class='op'>?</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_clone'>clone</span> <span class='op'>:</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
|
753
|
+
<span class='id identifier rubyid_target'>target</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span>
|
754
|
+
<span class='kw'>end</span>
|
755
|
+
<span class='id identifier rubyid_target'>target</span>
|
756
|
+
<span class='kw'>end</span></pre>
|
757
|
+
</td>
|
758
|
+
</tr>
|
759
|
+
</table>
|
760
|
+
</div>
|
761
|
+
|
762
|
+
<div class="method_details ">
|
763
|
+
<h3 class="signature " id="deep_stringify_keys-class_method">
|
764
|
+
|
765
|
+
.<strong>deep_stringify_keys</strong>(hash, should_clone = true) ⇒ <tt>Hash</tt>
|
766
|
+
|
767
|
+
|
768
|
+
|
769
|
+
|
770
|
+
|
771
|
+
</h3><div class="docstring">
|
772
|
+
<div class="discussion">
|
773
|
+
|
774
|
+
<p>Deep stringify keys from a hash.</p>
|
775
|
+
|
776
|
+
|
777
|
+
</div>
|
778
|
+
</div>
|
779
|
+
<div class="tags">
|
780
|
+
<p class="tag_title">Parameters:</p>
|
781
|
+
<ul class="param">
|
782
|
+
|
783
|
+
<li>
|
784
|
+
|
785
|
+
<span class='name'>hash</span>
|
786
|
+
|
787
|
+
|
788
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
789
|
+
|
790
|
+
|
791
|
+
|
792
|
+
—
|
793
|
+
<div class='inline'>
|
794
|
+
<p>Source hash to stringify keys.</p>
|
795
|
+
</div>
|
796
|
+
|
797
|
+
</li>
|
798
|
+
|
799
|
+
<li>
|
800
|
+
|
801
|
+
<span class='name'>should_clone</span>
|
802
|
+
|
803
|
+
|
804
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
805
|
+
|
806
|
+
|
807
|
+
<em class="default">(defaults to: <tt>true</tt>)</em>
|
808
|
+
|
809
|
+
|
810
|
+
—
|
811
|
+
<div class='inline'>
|
812
|
+
<p>(true) Target a hash clone to avoid affecting the same hash object.</p>
|
813
|
+
</div>
|
814
|
+
|
815
|
+
</li>
|
816
|
+
|
817
|
+
</ul>
|
818
|
+
|
819
|
+
<p class="tag_title">Returns:</p>
|
820
|
+
<ul class="return">
|
821
|
+
|
822
|
+
<li>
|
823
|
+
|
824
|
+
|
825
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
826
|
+
|
827
|
+
|
828
|
+
|
829
|
+
</li>
|
830
|
+
|
831
|
+
</ul>
|
832
|
+
|
833
|
+
</div><table class="source_code">
|
834
|
+
<tr>
|
835
|
+
<td>
|
836
|
+
<pre class="lines">
|
837
|
+
|
838
|
+
|
839
|
+
212
|
840
|
+
213
|
841
|
+
214
|
842
|
+
215
|
843
|
+
216
|
844
|
+
217
|
845
|
+
218
|
846
|
+
219
|
847
|
+
220
|
848
|
+
221
|
849
|
+
222
|
850
|
+
223
|
851
|
+
224
|
852
|
+
225
|
853
|
+
226
|
854
|
+
227
|
855
|
+
228
|
856
|
+
229
|
857
|
+
230</pre>
|
858
|
+
</td>
|
859
|
+
<td>
|
860
|
+
<pre class="code"><span class="info file"># File 'lib/dh_easy/core.rb', line 212</span>
|
861
|
+
|
862
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_deep_stringify_keys'>deep_stringify_keys</span> <span class='id identifier rubyid_hash'>hash</span><span class='comma'>,</span> <span class='id identifier rubyid_should_clone'>should_clone</span> <span class='op'>=</span> <span class='kw'>true</span>
|
863
|
+
<span class='kw'>return</span> <span class='id identifier rubyid_hash'>hash</span> <span class='kw'>unless</span> <span class='id identifier rubyid_hash'>hash</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'>Hash</span>
|
864
|
+
<span class='id identifier rubyid_pair_collection'>pair_collection</span> <span class='op'>=</span> <span class='id identifier rubyid_hash'>hash</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='comma'>,</span><span class='id identifier rubyid_v'>v</span><span class='rbracket'>]</span><span class='rbrace'>}</span>
|
865
|
+
<span class='id identifier rubyid_target'>target</span> <span class='op'>=</span> <span class='id identifier rubyid_should_clone'>should_clone</span> <span class='op'>?</span> <span class='lbrace'>{</span><span class='rbrace'>}</span> <span class='op'>:</span> <span class='id identifier rubyid_hash'>hash</span>
|
866
|
+
<span class='id identifier rubyid_target'>target</span><span class='period'>.</span><span class='id identifier rubyid_clear'>clear</span>
|
867
|
+
<span class='id identifier rubyid_pair_collection'>pair_collection</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_pair'>pair</span><span class='op'>|</span>
|
868
|
+
<span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='id identifier rubyid_pair'>pair</span>
|
869
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'>Array</span>
|
870
|
+
<span class='id identifier rubyid_array'>array</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
871
|
+
<span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_item'>item</span><span class='op'>|</span>
|
872
|
+
<span class='id identifier rubyid_array'>array</span> <span class='op'><<</span> <span class='id identifier rubyid_deep_stringify_keys'>deep_stringify_keys</span><span class='lparen'>(</span><span class='id identifier rubyid_item'>item</span><span class='comma'>,</span> <span class='id identifier rubyid_should_clone'>should_clone</span><span class='rparen'>)</span>
|
873
|
+
<span class='kw'>end</span>
|
874
|
+
<span class='id identifier rubyid_target'>target</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_array'>array</span>
|
875
|
+
<span class='kw'>next</span>
|
876
|
+
<span class='kw'>end</span>
|
877
|
+
<span class='id identifier rubyid_target'>target</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_deep_stringify_keys'>deep_stringify_keys</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='id identifier rubyid_should_clone'>should_clone</span><span class='rparen'>)</span>
|
878
|
+
<span class='kw'>end</span>
|
879
|
+
<span class='id identifier rubyid_target'>target</span>
|
880
|
+
<span class='kw'>end</span></pre>
|
881
|
+
</td>
|
882
|
+
</tr>
|
883
|
+
</table>
|
884
|
+
</div>
|
885
|
+
|
886
|
+
<div class="method_details ">
|
887
|
+
<h3 class="signature " id="deep_stringify_keys!-class_method">
|
888
|
+
|
889
|
+
.<strong>deep_stringify_keys!</strong>(hash) ⇒ <tt>Hash</tt>
|
890
|
+
|
891
|
+
|
892
|
+
|
893
|
+
|
894
|
+
|
895
|
+
</h3><div class="docstring">
|
896
|
+
<div class="discussion">
|
897
|
+
|
898
|
+
<p>Deep stringify all keys on hash object.</p>
|
899
|
+
|
900
|
+
|
901
|
+
</div>
|
902
|
+
</div>
|
903
|
+
<div class="tags">
|
904
|
+
<p class="tag_title">Parameters:</p>
|
905
|
+
<ul class="param">
|
906
|
+
|
907
|
+
<li>
|
908
|
+
|
909
|
+
<span class='name'>hash</span>
|
910
|
+
|
911
|
+
|
912
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
913
|
+
|
914
|
+
|
915
|
+
|
916
|
+
—
|
917
|
+
<div class='inline'>
|
918
|
+
<p>Hash to stringify keys.</p>
|
919
|
+
</div>
|
920
|
+
|
921
|
+
</li>
|
922
|
+
|
923
|
+
</ul>
|
924
|
+
|
925
|
+
<p class="tag_title">Returns:</p>
|
926
|
+
<ul class="return">
|
927
|
+
|
928
|
+
<li>
|
929
|
+
|
930
|
+
|
931
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
932
|
+
|
933
|
+
|
934
|
+
|
935
|
+
</li>
|
936
|
+
|
937
|
+
</ul>
|
938
|
+
|
939
|
+
</div><table class="source_code">
|
940
|
+
<tr>
|
941
|
+
<td>
|
942
|
+
<pre class="lines">
|
943
|
+
|
944
|
+
|
945
|
+
237
|
946
|
+
238
|
947
|
+
239</pre>
|
948
|
+
</td>
|
949
|
+
<td>
|
950
|
+
<pre class="code"><span class="info file"># File 'lib/dh_easy/core.rb', line 237</span>
|
951
|
+
|
952
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_deep_stringify_keys!'>deep_stringify_keys!</span> <span class='id identifier rubyid_hash'>hash</span>
|
953
|
+
<span class='id identifier rubyid_deep_stringify_keys'>deep_stringify_keys</span> <span class='id identifier rubyid_hash'>hash</span><span class='comma'>,</span> <span class='kw'>false</span>
|
954
|
+
<span class='kw'>end</span></pre>
|
955
|
+
</td>
|
956
|
+
</tr>
|
957
|
+
</table>
|
958
|
+
</div>
|
959
|
+
|
960
|
+
<div class="method_details ">
|
961
|
+
<h3 class="signature " id="expose_to-class_method">
|
962
|
+
|
963
|
+
.<strong>expose_to</strong>(object, env) ⇒ <tt>Object</tt>
|
964
|
+
|
965
|
+
|
966
|
+
|
967
|
+
|
968
|
+
|
969
|
+
</h3><div class="docstring">
|
970
|
+
<div class="discussion">
|
971
|
+
|
972
|
+
<p>Expose an environment into an object instance as methods.</p>
|
973
|
+
|
974
|
+
|
975
|
+
</div>
|
976
|
+
</div>
|
977
|
+
<div class="tags">
|
978
|
+
|
979
|
+
<div class="examples">
|
980
|
+
<p class="tag_title">Examples:</p>
|
981
|
+
|
982
|
+
|
983
|
+
<pre class="example code"><code><span class='kw'>class</span> <span class='const'>Foo</span>
|
984
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_hello_person'>hello_person</span>
|
985
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Hello person!</span><span class='tstring_end'>'</span></span>
|
986
|
+
<span class='kw'>end</span>
|
987
|
+
<span class='kw'>end</span>
|
988
|
+
|
989
|
+
<span class='id identifier rubyid_env'>env</span> <span class='op'>=</span> <span class='lbrace'>{</span>
|
990
|
+
<span class='label'>hello_world:</span> <span class='id identifier rubyid_lambda'>lambda</span><span class='lbrace'>{</span><span class='kw'>return</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Hello world!</span><span class='tstring_end'>'</span></span><span class='rbrace'>}</span><span class='comma'>,</span>
|
991
|
+
<span class='label'>hello_sky:</span> <span class='id identifier rubyid_proc'>proc</span><span class='lbrace'>{</span><span class='kw'>return</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Hello sky!</span><span class='tstring_end'>'</span></span><span class='rbrace'>}</span>
|
992
|
+
<span class='rbrace'>}</span>
|
993
|
+
<span class='id identifier rubyid_my_object'>my_object</span> <span class='op'>=</span> <span class='const'>Foo</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
994
|
+
<span class='const'><span class='object_link'><a href="../DhEasy.html" title="DhEasy (module)">DhEasy</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="DhEasy::Core (module)">Core</a></span></span><span class='period'>.</span><span class='id identifier rubyid_expose_to'>expose_to</span> <span class='id identifier rubyid_my_object'>my_object</span><span class='comma'>,</span> <span class='id identifier rubyid_env'>env</span>
|
995
|
+
|
996
|
+
<span class='id identifier rubyid_puts'>puts</span> <span class='id identifier rubyid_my_object'>my_object</span><span class='period'>.</span><span class='id identifier rubyid_hello_world'>hello_world</span>
|
997
|
+
<span class='comment'># => 'Hello world!'
|
998
|
+
</span><span class='id identifier rubyid_puts'>puts</span> <span class='id identifier rubyid_my_object'>my_object</span><span class='period'>.</span><span class='id identifier rubyid_hello_sky'>hello_sky</span>
|
999
|
+
<span class='comment'># => 'Hello sky!'
|
1000
|
+
</span><span class='id identifier rubyid_puts'>puts</span> <span class='id identifier rubyid_my_object'>my_object</span><span class='period'>.</span><span class='id identifier rubyid_hello_person'>hello_person</span>
|
1001
|
+
<span class='comment'># => 'Hello person!'</span></code></pre>
|
1002
|
+
|
1003
|
+
</div>
|
1004
|
+
<p class="tag_title">Parameters:</p>
|
1005
|
+
<ul class="param">
|
1006
|
+
|
1007
|
+
<li>
|
1008
|
+
|
1009
|
+
<span class='name'>object</span>
|
1010
|
+
|
1011
|
+
|
1012
|
+
<span class='type'></span>
|
1013
|
+
|
1014
|
+
|
1015
|
+
|
1016
|
+
—
|
1017
|
+
<div class='inline'>
|
1018
|
+
<p>Object instance to expose env into.</p>
|
1019
|
+
</div>
|
1020
|
+
|
1021
|
+
</li>
|
1022
|
+
|
1023
|
+
<li>
|
1024
|
+
|
1025
|
+
<span class='name'>env</span>
|
1026
|
+
|
1027
|
+
|
1028
|
+
<span class='type'>(<tt>Array</tt>)</span>
|
1029
|
+
|
1030
|
+
|
1031
|
+
|
1032
|
+
—
|
1033
|
+
<div class='inline'>
|
1034
|
+
<p>Hash with methods name as keys and blocks as actions.</p>
|
1035
|
+
</div>
|
1036
|
+
|
1037
|
+
</li>
|
1038
|
+
|
1039
|
+
</ul>
|
1040
|
+
|
1041
|
+
<p class="tag_title">Returns:</p>
|
1042
|
+
<ul class="return">
|
1043
|
+
|
1044
|
+
<li>
|
1045
|
+
|
1046
|
+
|
1047
|
+
<span class='type'></span>
|
1048
|
+
|
1049
|
+
|
1050
|
+
|
1051
|
+
|
1052
|
+
<div class='inline'>
|
1053
|
+
<p>`object`</p>
|
1054
|
+
</div>
|
1055
|
+
|
1056
|
+
</li>
|
1057
|
+
|
1058
|
+
</ul>
|
1059
|
+
|
1060
|
+
</div><table class="source_code">
|
1061
|
+
<tr>
|
1062
|
+
<td>
|
1063
|
+
<pre class="lines">
|
1064
|
+
|
1065
|
+
|
1066
|
+
97
|
1067
|
+
98
|
1068
|
+
99
|
1069
|
+
100
|
1070
|
+
101
|
1071
|
+
102
|
1072
|
+
103</pre>
|
1073
|
+
</td>
|
1074
|
+
<td>
|
1075
|
+
<pre class="code"><span class="info file"># File 'lib/dh_easy/core.rb', line 97</span>
|
1076
|
+
|
1077
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_expose_to'>expose_to</span> <span class='id identifier rubyid_object'>object</span><span class='comma'>,</span> <span class='id identifier rubyid_env'>env</span>
|
1078
|
+
<span class='id identifier rubyid_metaclass'>metaclass</span> <span class='op'>=</span> <span class='kw'>class</span> <span class='op'><<</span> <span class='id identifier rubyid_object'>object</span><span class='semicolon'>;</span> <span class='kw'>self</span><span class='semicolon'>;</span> <span class='kw'>end</span>
|
1079
|
+
<span class='id identifier rubyid_env'>env</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_block'>block</span><span class='op'>|</span>
|
1080
|
+
<span class='id identifier rubyid_metaclass'>metaclass</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='symbol'>:define_method</span><span class='comma'>,</span> <span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
1081
|
+
<span class='kw'>end</span>
|
1082
|
+
<span class='id identifier rubyid_object'>object</span>
|
1083
|
+
<span class='kw'>end</span></pre>
|
1084
|
+
</td>
|
1085
|
+
</tr>
|
1086
|
+
</table>
|
1087
|
+
</div>
|
1088
|
+
|
1089
|
+
<div class="method_details ">
|
1090
|
+
<h3 class="signature " id="instance_methods_from-class_method">
|
1091
|
+
|
1092
|
+
.<strong>instance_methods_from</strong>(object, class_only = false) ⇒ <tt>Array</tt>
|
1093
|
+
|
1094
|
+
|
1095
|
+
|
1096
|
+
|
1097
|
+
|
1098
|
+
</h3><div class="docstring">
|
1099
|
+
<div class="discussion">
|
1100
|
+
|
1101
|
+
<p>Retrieve instance methods from an object.</p>
|
1102
|
+
|
1103
|
+
|
1104
|
+
</div>
|
1105
|
+
</div>
|
1106
|
+
<div class="tags">
|
1107
|
+
|
1108
|
+
<div class="examples">
|
1109
|
+
<p class="tag_title">Examples:</p>
|
1110
|
+
|
1111
|
+
|
1112
|
+
<pre class="example code"><code><span class='kw'>class</span> <span class='const'>Foo</span>
|
1113
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_hello_world'>hello_world</span>
|
1114
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Hello world!</span><span class='tstring_end'>'</span></span>
|
1115
|
+
<span class='kw'>end</span>
|
1116
|
+
|
1117
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_hello_person'>hello_person</span>
|
1118
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Hello person!</span><span class='tstring_end'>'</span></span>
|
1119
|
+
<span class='kw'>end</span>
|
1120
|
+
<span class='kw'>end</span>
|
1121
|
+
|
1122
|
+
<span class='id identifier rubyid_my_object'>my_object</span> <span class='op'>=</span> <span class='const'>Foo</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
1123
|
+
<span class='const'><span class='object_link'><a href="../DhEasy.html" title="DhEasy (module)">DhEasy</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="DhEasy::Core (module)">Core</a></span></span><span class='period'>.</span><span class='id identifier rubyid_instance_methods_from'>instance_methods_from</span> <span class='id identifier rubyid_my_object'>my_object</span>
|
1124
|
+
<span class='comment'># => [:hello_world, :hello_person]</span></code></pre>
|
1125
|
+
|
1126
|
+
</div>
|
1127
|
+
<p class="tag_title">Parameters:</p>
|
1128
|
+
<ul class="param">
|
1129
|
+
|
1130
|
+
<li>
|
1131
|
+
|
1132
|
+
<span class='name'>object</span>
|
1133
|
+
|
1134
|
+
|
1135
|
+
<span class='type'></span>
|
1136
|
+
|
1137
|
+
|
1138
|
+
|
1139
|
+
—
|
1140
|
+
<div class='inline'>
|
1141
|
+
<p>Object with instance methods.</p>
|
1142
|
+
</div>
|
1143
|
+
|
1144
|
+
</li>
|
1145
|
+
|
1146
|
+
<li>
|
1147
|
+
|
1148
|
+
<span class='name'>class_only</span>
|
1149
|
+
|
1150
|
+
|
1151
|
+
<span class='type'>(<tt>false</tt>)</span>
|
1152
|
+
|
1153
|
+
|
1154
|
+
<em class="default">(defaults to: <tt>false</tt>)</em>
|
1155
|
+
|
1156
|
+
|
1157
|
+
—
|
1158
|
+
<div class='inline'>
|
1159
|
+
<p>Will get class only methods when `true`.</p>
|
1160
|
+
</div>
|
1161
|
+
|
1162
|
+
</li>
|
1163
|
+
|
1164
|
+
</ul>
|
1165
|
+
|
1166
|
+
<p class="tag_title">Returns:</p>
|
1167
|
+
<ul class="return">
|
1168
|
+
|
1169
|
+
<li>
|
1170
|
+
|
1171
|
+
|
1172
|
+
<span class='type'>(<tt>Array</tt>)</span>
|
1173
|
+
|
1174
|
+
|
1175
|
+
|
1176
|
+
</li>
|
1177
|
+
|
1178
|
+
</ul>
|
1179
|
+
|
1180
|
+
</div><table class="source_code">
|
1181
|
+
<tr>
|
1182
|
+
<td>
|
1183
|
+
<pre class="lines">
|
1184
|
+
|
1185
|
+
|
1186
|
+
126
|
1187
|
+
127
|
1188
|
+
128</pre>
|
1189
|
+
</td>
|
1190
|
+
<td>
|
1191
|
+
<pre class="code"><span class="info file"># File 'lib/dh_easy/core.rb', line 126</span>
|
1192
|
+
|
1193
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_instance_methods_from'>instance_methods_from</span> <span class='id identifier rubyid_object'>object</span><span class='comma'>,</span> <span class='id identifier rubyid_class_only'>class_only</span> <span class='op'>=</span> <span class='kw'>false</span>
|
1194
|
+
<span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_methods'>methods</span><span class='lparen'>(</span><span class='op'>!</span><span class='id identifier rubyid_class_only'>class_only</span><span class='rparen'>)</span> <span class='op'>-</span> <span class='const'>Object</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='period'>.</span><span class='id identifier rubyid_methods'>methods</span><span class='lparen'>(</span><span class='op'>!</span><span class='id identifier rubyid_class_only'>class_only</span><span class='rparen'>)</span>
|
1195
|
+
<span class='kw'>end</span></pre>
|
1196
|
+
</td>
|
1197
|
+
</tr>
|
1198
|
+
</table>
|
1199
|
+
</div>
|
1200
|
+
|
1201
|
+
<div class="method_details ">
|
1202
|
+
<h3 class="signature " id="mock_instance_methods-class_method">
|
1203
|
+
|
1204
|
+
.<strong>mock_instance_methods</strong>(origin, target) ⇒ <tt>Object</tt>
|
1205
|
+
|
1206
|
+
|
1207
|
+
|
1208
|
+
|
1209
|
+
|
1210
|
+
</h3><div class="docstring">
|
1211
|
+
<div class="discussion">
|
1212
|
+
|
1213
|
+
<p>Mock instances methods from the origin into target object.</p>
|
1214
|
+
|
1215
|
+
|
1216
|
+
</div>
|
1217
|
+
</div>
|
1218
|
+
<div class="tags">
|
1219
|
+
|
1220
|
+
<div class="examples">
|
1221
|
+
<p class="tag_title">Examples:</p>
|
1222
|
+
|
1223
|
+
|
1224
|
+
<pre class="example code"><code><span class='kw'>class</span> <span class='const'>Boo</span>
|
1225
|
+
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:message</span>
|
1226
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
|
1227
|
+
<span class='id identifier rubyid_message'>message</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Hello world!</span><span class='tstring_end'>'</span></span>
|
1228
|
+
<span class='kw'>end</span>
|
1229
|
+
|
1230
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_hello_world'>hello_world</span>
|
1231
|
+
<span class='id identifier rubyid_message'>message</span>
|
1232
|
+
<span class='kw'>end</span>
|
1233
|
+
<span class='kw'>end</span>
|
1234
|
+
|
1235
|
+
<span class='kw'>class</span> <span class='const'>Foo</span>
|
1236
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_hello_person'>hello_person</span>
|
1237
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Hello person!</span><span class='tstring_end'>'</span></span>
|
1238
|
+
<span class='kw'>end</span>
|
1239
|
+
<span class='kw'>end</span>
|
1240
|
+
|
1241
|
+
<span class='id identifier rubyid_origin'>origin</span> <span class='op'>=</span> <span class='const'>Boo</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
1242
|
+
<span class='id identifier rubyid_target'>target</span> <span class='op'>=</span> <span class='const'>Foo</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
1243
|
+
<span class='const'><span class='object_link'><a href="../DhEasy.html" title="DhEasy (module)">DhEasy</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="DhEasy::Core (module)">Core</a></span></span><span class='period'>.</span><span class='id identifier rubyid_mock_instance_methods'>mock_instance_methods</span> <span class='id identifier rubyid_origin'>origin</span> <span class='id identifier rubyid_target'>target</span>
|
1244
|
+
|
1245
|
+
<span class='id identifier rubyid_puts'>puts</span> <span class='id identifier rubyid_target'>target</span><span class='period'>.</span><span class='id identifier rubyid_hello_world'>hello_world</span>
|
1246
|
+
<span class='comment'># => 'Hello world!'
|
1247
|
+
</span><span class='id identifier rubyid_puts'>puts</span> <span class='id identifier rubyid_target'>target</span><span class='period'>.</span><span class='id identifier rubyid_hello_person'>hello_person</span>
|
1248
|
+
<span class='comment'># => 'Hello person!'
|
1249
|
+
</span>
|
1250
|
+
<span class='id identifier rubyid_origin'>origin</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Hello world again!</span><span class='tstring_end'>'</span></span>
|
1251
|
+
<span class='id identifier rubyid_puts'>puts</span> <span class='id identifier rubyid_target'>target</span><span class='period'>.</span><span class='id identifier rubyid_hello_world'>hello_world</span>
|
1252
|
+
<span class='comment'># => 'Hello world again!'</span></code></pre>
|
1253
|
+
|
1254
|
+
</div>
|
1255
|
+
<p class="tag_title">Parameters:</p>
|
1256
|
+
<ul class="param">
|
1257
|
+
|
1258
|
+
<li>
|
1259
|
+
|
1260
|
+
<span class='name'>origin</span>
|
1261
|
+
|
1262
|
+
|
1263
|
+
<span class='type'></span>
|
1264
|
+
|
1265
|
+
|
1266
|
+
|
1267
|
+
—
|
1268
|
+
<div class='inline'>
|
1269
|
+
<p>Object with instance methods to mock.</p>
|
1270
|
+
</div>
|
1271
|
+
|
1272
|
+
</li>
|
1273
|
+
|
1274
|
+
<li>
|
1275
|
+
|
1276
|
+
<span class='name'>target</span>
|
1277
|
+
|
1278
|
+
|
1279
|
+
<span class='type'></span>
|
1280
|
+
|
1281
|
+
|
1282
|
+
|
1283
|
+
—
|
1284
|
+
<div class='inline'>
|
1285
|
+
<p>Object instance to mock methods into.</p>
|
1286
|
+
</div>
|
1287
|
+
|
1288
|
+
</li>
|
1289
|
+
|
1290
|
+
</ul>
|
1291
|
+
|
1292
|
+
|
1293
|
+
</div><table class="source_code">
|
1294
|
+
<tr>
|
1295
|
+
<td>
|
1296
|
+
<pre class="lines">
|
1297
|
+
|
1298
|
+
|
1299
|
+
165
|
1300
|
+
166
|
1301
|
+
167
|
1302
|
+
168
|
1303
|
+
169
|
1304
|
+
170
|
1305
|
+
171
|
1306
|
+
172
|
1307
|
+
173
|
1308
|
+
174
|
1309
|
+
175
|
1310
|
+
176
|
1311
|
+
177
|
1312
|
+
178</pre>
|
1313
|
+
</td>
|
1314
|
+
<td>
|
1315
|
+
<pre class="code"><span class="info file"># File 'lib/dh_easy/core.rb', line 165</span>
|
1316
|
+
|
1317
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_mock_instance_methods'>mock_instance_methods</span> <span class='id identifier rubyid_origin'>origin</span><span class='comma'>,</span> <span class='id identifier rubyid_target'>target</span>
|
1318
|
+
<span class='comment'># Get instance unique methods
|
1319
|
+
</span> <span class='id identifier rubyid_method_list'>method_list</span> <span class='op'>=</span> <span class='id identifier rubyid_instance_methods_from'>instance_methods_from</span> <span class='id identifier rubyid_origin'>origin</span>
|
1320
|
+
<span class='id identifier rubyid_method_list'>method_list</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='symbol'>:context_binding</span> <span class='kw'>if</span> <span class='id identifier rubyid_method_list'>method_list</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span> <span class='symbol'>:context_binding</span>
|
1321
|
+
|
1322
|
+
<span class='comment'># Build env reflecting origin unique methods
|
1323
|
+
</span> <span class='id identifier rubyid_env'>env</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
1324
|
+
<span class='id identifier rubyid_method_list'>method_list</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_method'>method</span><span class='op'>|</span>
|
1325
|
+
<span class='id identifier rubyid_env'>env</span><span class='lbracket'>[</span><span class='id identifier rubyid_method'>method</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_lambda'>lambda</span><span class='lbrace'>{</span><span class='op'>|</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='op'>|</span><span class='id identifier rubyid_origin'>origin</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span><span class='rbrace'>}</span>
|
1326
|
+
<span class='kw'>end</span>
|
1327
|
+
|
1328
|
+
<span class='comment'># Mock origin unique methods into target
|
1329
|
+
</span> <span class='id identifier rubyid_expose_to'>expose_to</span> <span class='id identifier rubyid_target'>target</span><span class='comma'>,</span> <span class='id identifier rubyid_env'>env</span>
|
1330
|
+
<span class='kw'>end</span></pre>
|
1331
|
+
</td>
|
1332
|
+
</tr>
|
1333
|
+
</table>
|
1334
|
+
</div>
|
1335
|
+
|
1336
|
+
<div class="method_details ">
|
1337
|
+
<h3 class="signature " id="require_all-class_method">
|
1338
|
+
|
1339
|
+
.<strong>require_all</strong>(dir, opts = {}) ⇒ <tt>Object</tt>
|
1340
|
+
|
1341
|
+
|
1342
|
+
|
1343
|
+
|
1344
|
+
|
1345
|
+
</h3><div class="docstring">
|
1346
|
+
<div class="discussion">
|
1347
|
+
|
1348
|
+
<p>Require all scripts within a directory.</p>
|
1349
|
+
|
1350
|
+
|
1351
|
+
</div>
|
1352
|
+
</div>
|
1353
|
+
<div class="tags">
|
1354
|
+
<p class="tag_title">Parameters:</p>
|
1355
|
+
<ul class="param">
|
1356
|
+
|
1357
|
+
<li>
|
1358
|
+
|
1359
|
+
<span class='name'>dir</span>
|
1360
|
+
|
1361
|
+
|
1362
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1363
|
+
|
1364
|
+
|
1365
|
+
|
1366
|
+
—
|
1367
|
+
<div class='inline'>
|
1368
|
+
<p>Directory containing `.rb` scripts.</p>
|
1369
|
+
</div>
|
1370
|
+
|
1371
|
+
</li>
|
1372
|
+
|
1373
|
+
<li>
|
1374
|
+
|
1375
|
+
<span class='name'>opts</span>
|
1376
|
+
|
1377
|
+
|
1378
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
1379
|
+
|
1380
|
+
|
1381
|
+
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
1382
|
+
|
1383
|
+
|
1384
|
+
—
|
1385
|
+
<div class='inline'>
|
1386
|
+
<p>({}) Configuration options.</p>
|
1387
|
+
</div>
|
1388
|
+
|
1389
|
+
</li>
|
1390
|
+
|
1391
|
+
</ul>
|
1392
|
+
|
1393
|
+
|
1394
|
+
|
1395
|
+
|
1396
|
+
|
1397
|
+
|
1398
|
+
<p class="tag_title">Options Hash (<tt>opts</tt>):</p>
|
1399
|
+
<ul class="option">
|
1400
|
+
|
1401
|
+
<li>
|
1402
|
+
<span class="name">:except</span>
|
1403
|
+
<span class="type">(<tt>Array</tt>)</span>
|
1404
|
+
<span class="default">
|
1405
|
+
|
1406
|
+
— default:
|
1407
|
+
<tt>nil</tt>
|
1408
|
+
|
1409
|
+
</span>
|
1410
|
+
|
1411
|
+
— <div class='inline'>
|
1412
|
+
<p>Literal file collection excluded from process.</p>
|
1413
|
+
</div>
|
1414
|
+
|
1415
|
+
</li>
|
1416
|
+
|
1417
|
+
</ul>
|
1418
|
+
|
1419
|
+
|
1420
|
+
|
1421
|
+
</div><table class="source_code">
|
1422
|
+
<tr>
|
1423
|
+
<td>
|
1424
|
+
<pre class="lines">
|
1425
|
+
|
1426
|
+
|
1427
|
+
42
|
1428
|
+
43
|
1429
|
+
44
|
1430
|
+
45
|
1431
|
+
46
|
1432
|
+
47
|
1433
|
+
48
|
1434
|
+
49
|
1435
|
+
50
|
1436
|
+
51
|
1437
|
+
52
|
1438
|
+
53</pre>
|
1439
|
+
</td>
|
1440
|
+
<td>
|
1441
|
+
<pre class="code"><span class="info file"># File 'lib/dh_easy/core.rb', line 42</span>
|
1442
|
+
|
1443
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_require_all'>require_all</span> <span class='id identifier rubyid_dir'>dir</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
1444
|
+
<span class='id identifier rubyid_dir_list'>dir_list</span> <span class='op'>=</span> <span class='id identifier rubyid_real_dir_list'>real_dir_list</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
1445
|
+
<span class='id identifier rubyid_real_except'>real_except</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:except</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_f'>f</span><span class='op'>|</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_f'>f</span><span class='embexpr_end'>}</span><span class='tstring_content'>.rb</span><span class='tstring_end'>"</span></span><span class='rbrace'>}</span>
|
1446
|
+
<span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='id identifier rubyid_opts'>opts</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span> <span class='label'>except:</span> <span class='id identifier rubyid_real_except'>real_except</span>
|
1447
|
+
<span class='gvar'>$LOAD_PATH</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_load_path'>load_path</span><span class='op'>|</span>
|
1448
|
+
<span class='id identifier rubyid_dir_list'>dir_list</span> <span class='op'>=</span> <span class='const'>Dir</span><span class='period'>.</span><span class='id identifier rubyid_glob'>glob</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='id identifier rubyid_load_path'>load_path</span><span class='comma'>,</span> <span class='id identifier rubyid_dir'>dir</span><span class='rparen'>)</span>
|
1449
|
+
<span class='id identifier rubyid_dir_list'>dir_list</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_real_dir'>real_dir</span><span class='op'>|</span>
|
1450
|
+
<span class='kw'>next</span> <span class='kw'>unless</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_directory?'>directory?</span> <span class='id identifier rubyid_real_dir'>real_dir</span>
|
1451
|
+
<span class='id identifier rubyid_all_scripts'>all_scripts</span><span class='lparen'>(</span><span class='id identifier rubyid_real_dir'>real_dir</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_file'>file</span><span class='op'>|</span> <span class='id identifier rubyid_require'>require</span> <span class='id identifier rubyid_file'>file</span><span class='rbrace'>}</span>
|
1452
|
+
<span class='kw'>end</span>
|
1453
|
+
<span class='kw'>end</span>
|
1454
|
+
<span class='kw'>end</span></pre>
|
1455
|
+
</td>
|
1456
|
+
</tr>
|
1457
|
+
</table>
|
1458
|
+
</div>
|
1459
|
+
|
1460
|
+
<div class="method_details ">
|
1461
|
+
<h3 class="signature " id="require_relative_all-class_method">
|
1462
|
+
|
1463
|
+
.<strong>require_relative_all</strong>(dir, opts = {}) ⇒ <tt>Object</tt>
|
1464
|
+
|
1465
|
+
|
1466
|
+
|
1467
|
+
|
1468
|
+
|
1469
|
+
</h3><div class="docstring">
|
1470
|
+
<div class="discussion">
|
1471
|
+
|
1472
|
+
<p>Require all relative scripts paths within a directory.</p>
|
1473
|
+
|
1474
|
+
|
1475
|
+
</div>
|
1476
|
+
</div>
|
1477
|
+
<div class="tags">
|
1478
|
+
<p class="tag_title">Parameters:</p>
|
1479
|
+
<ul class="param">
|
1480
|
+
|
1481
|
+
<li>
|
1482
|
+
|
1483
|
+
<span class='name'>dir</span>
|
1484
|
+
|
1485
|
+
|
1486
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1487
|
+
|
1488
|
+
|
1489
|
+
|
1490
|
+
—
|
1491
|
+
<div class='inline'>
|
1492
|
+
<p>Directory containing `.rb` scripts.</p>
|
1493
|
+
</div>
|
1494
|
+
|
1495
|
+
</li>
|
1496
|
+
|
1497
|
+
<li>
|
1498
|
+
|
1499
|
+
<span class='name'>opts</span>
|
1500
|
+
|
1501
|
+
|
1502
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
1503
|
+
|
1504
|
+
|
1505
|
+
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
1506
|
+
|
1507
|
+
|
1508
|
+
—
|
1509
|
+
<div class='inline'>
|
1510
|
+
<p>({}) Configuration options.</p>
|
1511
|
+
</div>
|
1512
|
+
|
1513
|
+
</li>
|
1514
|
+
|
1515
|
+
</ul>
|
1516
|
+
|
1517
|
+
|
1518
|
+
|
1519
|
+
|
1520
|
+
|
1521
|
+
|
1522
|
+
<p class="tag_title">Options Hash (<tt>opts</tt>):</p>
|
1523
|
+
<ul class="option">
|
1524
|
+
|
1525
|
+
<li>
|
1526
|
+
<span class="name">:except</span>
|
1527
|
+
<span class="type">(<tt>Array</tt>)</span>
|
1528
|
+
<span class="default">
|
1529
|
+
|
1530
|
+
— default:
|
1531
|
+
<tt>nil</tt>
|
1532
|
+
|
1533
|
+
</span>
|
1534
|
+
|
1535
|
+
— <div class='inline'>
|
1536
|
+
<p>Literal file collection excluded from process.</p>
|
1537
|
+
</div>
|
1538
|
+
|
1539
|
+
</li>
|
1540
|
+
|
1541
|
+
</ul>
|
1542
|
+
|
1543
|
+
|
1544
|
+
|
1545
|
+
</div><table class="source_code">
|
1546
|
+
<tr>
|
1547
|
+
<td>
|
1548
|
+
<pre class="lines">
|
1549
|
+
|
1550
|
+
|
1551
|
+
60
|
1552
|
+
61
|
1553
|
+
62
|
1554
|
+
63
|
1555
|
+
64
|
1556
|
+
65
|
1557
|
+
66
|
1558
|
+
67
|
1559
|
+
68</pre>
|
1560
|
+
</td>
|
1561
|
+
<td>
|
1562
|
+
<pre class="code"><span class="info file"># File 'lib/dh_easy/core.rb', line 60</span>
|
1563
|
+
|
1564
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_require_relative_all'>require_relative_all</span> <span class='id identifier rubyid_dir'>dir</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
1565
|
+
<span class='id identifier rubyid_real_except'>real_except</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:except</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_f'>f</span><span class='op'>|</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_f'>f</span><span class='embexpr_end'>}</span><span class='tstring_content'>.rb</span><span class='tstring_end'>"</span></span><span class='rbrace'>}</span>
|
1566
|
+
<span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='id identifier rubyid_opts'>opts</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span> <span class='label'>except:</span> <span class='id identifier rubyid_real_except'>real_except</span>
|
1567
|
+
<span class='id identifier rubyid_dir_list'>dir_list</span> <span class='op'>=</span> <span class='const'>Dir</span><span class='period'>.</span><span class='id identifier rubyid_glob'>glob</span> <span class='id identifier rubyid_dir'>dir</span>
|
1568
|
+
<span class='id identifier rubyid_dir_list'>dir_list</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_relative_dir'>relative_dir</span><span class='op'>|</span>
|
1569
|
+
<span class='id identifier rubyid_real_dir'>real_dir</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span> <span class='id identifier rubyid_relative_dir'>relative_dir</span>
|
1570
|
+
<span class='id identifier rubyid_all_scripts'>all_scripts</span><span class='lparen'>(</span><span class='id identifier rubyid_real_dir'>real_dir</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_file'>file</span><span class='op'>|</span> <span class='id identifier rubyid_require'>require</span> <span class='id identifier rubyid_file'>file</span><span class='rbrace'>}</span>
|
1571
|
+
<span class='kw'>end</span>
|
1572
|
+
<span class='kw'>end</span></pre>
|
1573
|
+
</td>
|
1574
|
+
</tr>
|
1575
|
+
</table>
|
1576
|
+
</div>
|
1577
|
+
|
1578
|
+
</div>
|
1579
|
+
|
1580
|
+
</div>
|
1581
|
+
|
1582
|
+
<div id="footer">
|
1583
|
+
Generated on Wed Dec 4 23:00:02 2019 by
|
1584
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1585
|
+
0.9.20 (ruby-2.5.3).
|
1586
|
+
</div>
|
1587
|
+
|
1588
|
+
</div>
|
1589
|
+
</body>
|
1590
|
+
</html>
|