porolog 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +5 -2
- data/coverage/badge.svg +1 -0
- data/coverage/index.html +7090 -0
- data/doc/Porolog.html +337 -0
- data/doc/_index.html +187 -0
- data/doc/class_list.html +51 -0
- data/doc/file.README.html +250 -0
- data/doc/file_list.html +56 -0
- data/doc/frames.html +17 -0
- data/doc/index.html +250 -0
- data/doc/method_list.html +403 -0
- data/doc/top-level-namespace.html +110 -0
- data/lib/porolog/arguments.rb +173 -0
- data/lib/porolog/predicate.rb +3 -2
- data/lib/porolog/scope.rb +3 -2
- data/lib/porolog.rb +4 -2
- data/test/porolog/arguments_test.rb +790 -0
- data/test/porolog/porolog_test.rb +67 -0
- data/test/porolog/predicate_test.rb +27 -9
- data/test/porolog/scope_test.rb +13 -13
- data/test/test_helper.rb +22 -2
- metadata +20 -3
data/lib/porolog/predicate.rb
CHANGED
@@ -96,10 +96,11 @@ module Porolog
|
|
96
96
|
end
|
97
97
|
|
98
98
|
# Add a Rule to the Predicate.
|
99
|
-
# @param rule [Object]
|
100
|
-
# @return [
|
99
|
+
# @param rule [Object] a rule to add to the Predicate.
|
100
|
+
# @return [Porolog::Predicate] the Predicate.
|
101
101
|
def <<(rule)
|
102
102
|
@rules << rule
|
103
|
+
self
|
103
104
|
end
|
104
105
|
|
105
106
|
# A pretty print String of the Predicate.
|
data/lib/porolog/scope.rb
CHANGED
@@ -23,7 +23,7 @@ module Porolog
|
|
23
23
|
attr_reader :name
|
24
24
|
|
25
25
|
# Creates a new Scope unless it already exists.
|
26
|
-
# @param name [Object] the name (or otherwise object) used to register a scope.
|
26
|
+
# @param name [Symbol, Object] the name (or otherwise object) used to register a scope.
|
27
27
|
# @return [Porolog::Scope] new or existing Scope.
|
28
28
|
def self.new(name)
|
29
29
|
@@scopes[name] || super
|
@@ -55,7 +55,8 @@ module Porolog
|
|
55
55
|
end
|
56
56
|
|
57
57
|
# Returns the names of all registered Scopes.
|
58
|
-
# @return [Array<Symbol
|
58
|
+
# @return [Array<Symbol>] the names if scopes are named as Symbols (the intended case).
|
59
|
+
# @return [Array<Object>] the names if the names are not actually Symbols.
|
59
60
|
def self.scopes
|
60
61
|
@@scopes.keys
|
61
62
|
end
|
data/lib/porolog.rb
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
module Porolog
|
9
9
|
|
10
10
|
# The most recent version of the Porolog gem.
|
11
|
-
VERSION = '0.0.
|
11
|
+
VERSION = '0.0.4'
|
12
12
|
# The most recent date of when the VERSION changed.
|
13
13
|
VERSION_DATE = '2019-04-21'
|
14
14
|
|
@@ -16,7 +16,8 @@ module Porolog
|
|
16
16
|
# that returns an Arguments based on the arguments provided to
|
17
17
|
# the method.
|
18
18
|
# @param names [Array<#to_sym>] names of the Predicates to create.
|
19
|
-
# @return [Porolog::Predicate
|
19
|
+
# @return [Porolog::Predicate] Predicate created if only one name is provided
|
20
|
+
# @return [Array<Porolog::Predicate>] Predicates created if multiple names are provided
|
20
21
|
def predicate(*names)
|
21
22
|
names = [names].flatten
|
22
23
|
|
@@ -39,3 +40,4 @@ end
|
|
39
40
|
require_relative 'porolog/error'
|
40
41
|
require_relative 'porolog/scope'
|
41
42
|
require_relative 'porolog/predicate'
|
43
|
+
require_relative 'porolog/arguments'
|