core-define 0.0.0 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/core/define/version.rb +1 -1
- data/lib/is/definable.rb +18 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 546a6331dced26f191383e62daebae9b91ffb1c352c6b757e5268833df7fdf8c
|
4
|
+
data.tar.gz: 55477f27d167b4bbf87c084ca65fc1606df6abd371dbcad1cb3c5894764a5439
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a43f7447d1b71371770b95e5b249a259eacf14ebda5bae619c45c7c004321450a5074d5f06047e28bacf7fa390365b042174abdd2f57198c9b50b13b7da9a0e
|
7
|
+
data.tar.gz: ee3980f0268d8b2009c1c5c01a0e8323f369f68858e3e29346a3d8eff807e6334851a24e27ca4616541fed9551a468fe90f61dfe77ac3b6d9f60b3f6c32c46f2
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
## [v0.1.0](https://github.com/metabahn/corerb/releases/tag/2021-11-02)
|
2
|
+
|
3
|
+
*released on 2021-11-02*
|
4
|
+
|
5
|
+
* `add` [#93](https://github.com/metabahn/corerb/pull/93) Allow locations to be passed to defined objects ([bryanp](https://github.com/bryanp))
|
6
|
+
|
1
7
|
## [v0.0.0](https://github.com/metabahn/corerb/releases/tag/2021-10-25)
|
2
8
|
|
3
9
|
*released on 2021-10-25*
|
data/lib/core/define/version.rb
CHANGED
data/lib/is/definable.rb
CHANGED
@@ -22,9 +22,15 @@ module Is
|
|
22
22
|
end
|
23
23
|
|
24
24
|
extends :definition, dependencies: [Is::Eventable] do
|
25
|
-
# [public]
|
25
|
+
# [public] Defines an object by `name`, within `namespace`.
|
26
|
+
#
|
27
|
+
# Options passed as keyword arguments are defined as state on the new object.
|
26
28
|
#
|
27
|
-
|
29
|
+
# The `__location__` keyword argument is considered part of the public api and must be an instance of
|
30
|
+
# `Core::Define::Location`. It's passed using an internal naming convention to avoid possible collisions with
|
31
|
+
# other passed state. If not given, the object's location is based on `caller`.
|
32
|
+
#
|
33
|
+
def define(*namespace, name, __location__: nil, **kwargs, &block)
|
28
34
|
scope = if namespace.any?
|
29
35
|
define_namespace(*namespace)
|
30
36
|
else
|
@@ -36,8 +42,16 @@ module Is
|
|
36
42
|
if scope.const_defined?(constant)
|
37
43
|
defined = scope.const_get(constant)
|
38
44
|
else
|
39
|
-
|
40
|
-
|
45
|
+
location = if __location__
|
46
|
+
unless __location__.respond_to?(:path) && __location__.respond_to?(:line)
|
47
|
+
raise ArgumentError, "expected location to respond to `path` and `line`"
|
48
|
+
end
|
49
|
+
|
50
|
+
__location__
|
51
|
+
else
|
52
|
+
path, line = caller(1..1).first.split(":", 3)
|
53
|
+
Core::Define::Location.new(path: path, line: line)
|
54
|
+
end
|
41
55
|
|
42
56
|
performing "core.define" do
|
43
57
|
# Create the right kind of object for `self`.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: core-define
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bryan Powell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: core-copy
|