reflekt 1.0.9 → 1.0.10

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.
@@ -1,35 +1,35 @@
1
1
  require_relative '../rule'
2
2
 
3
3
  module Reflekt
4
- class NullRule < Rule
5
-
6
- def initialize()
7
- @type = :null
8
- end
9
-
10
- ##
11
- # @param meta [NullMeta]
12
- ##
13
- def train(meta)
14
- # No need to train as NullMeta is always nil.
4
+ class NullRule < Rule
5
+
6
+ def initialize()
7
+ @type = :null
8
+ end
9
+
10
+ ##
11
+ # @param meta [NullMeta]
12
+ ##
13
+ def train(meta)
14
+ # No need to train as NullMeta is always nil.
15
+ end
16
+
17
+ ##
18
+ # @param value [NilClass]
19
+ ##
20
+ def test(value)
21
+ value.nil?
22
+ end
23
+
24
+ def result()
25
+ {
26
+ :type => @type
27
+ }
28
+ end
29
+
30
+ def random()
31
+ nil
32
+ end
33
+
15
34
  end
16
-
17
- ##
18
- # @param value [NilClass]
19
- ##
20
- def test(value)
21
- value.nil?
22
- end
23
-
24
- def result()
25
- {
26
- :type => @type
27
- }
28
- end
29
-
30
- def random()
31
- nil
32
- end
33
-
34
- end
35
35
  end
@@ -1,83 +1,75 @@
1
1
  require_relative '../rule'
2
2
 
3
3
  module Reflekt
4
- class StringRule < Rule
4
+ class StringRule < Rule
5
5
 
6
- attr_accessor :min_length
7
- attr_accessor :max_length
6
+ attr_accessor :min_length
7
+ attr_accessor :max_length
8
8
 
9
- def initialize()
9
+ def initialize()
10
+ @type = :string
11
+ @min_length = nil
12
+ @max_length = nil
13
+ end
10
14
 
11
- @type = :string
12
- @min_length = nil
13
- @max_length = nil
15
+ ##
16
+ # @param meta [StringMeta]
17
+ ##
18
+ def train(meta)
19
+ length = meta[:length]
14
20
 
15
- end
21
+ if @min_length.nil?
22
+ @min_length = length
23
+ else
24
+ @min_length = length if length < @min_length
25
+ end
16
26
 
17
- ##
18
- # @param meta [StringMeta]
19
- ##
20
- def train(meta)
27
+ if @max_length.nil?
28
+ @max_length = length
29
+ else
30
+ @max_length = length if length > @max_length
31
+ end
32
+ end
21
33
 
22
- length = meta[:length]
34
+ ##
35
+ # @param value [String]
36
+ ##
37
+ def test(value)
38
+ length = value.length
23
39
 
24
- if @min_length.nil?
25
- @min_length = length
26
- else
27
- @min_length = length if length < @min_length
40
+ return false if length < @min_length
41
+ return false if length > @max_length
42
+ true
28
43
  end
29
44
 
30
- if @max_length.nil?
31
- @max_length = length
32
- else
33
- @max_length = length if length > @max_length
45
+ def result()
46
+ {
47
+ :type => @type,
48
+ :min_length => @min_length,
49
+ :max_length => @max_length
50
+ }
34
51
  end
35
52
 
36
- end
37
-
38
- ##
39
- # @param value [String]
40
- ##
41
- def test(value)
42
-
43
- length = value.length
44
-
45
- return false if length < @min_length
46
- return false if length > @max_length
47
-
48
- true
49
- end
50
-
51
- def result()
52
- {
53
- :type => @type,
54
- :min_length => @min_length,
55
- :max_length => @max_length
56
- }
57
- end
58
-
59
- def random()
60
-
61
- # Build alphabet soup.
62
- alpha_numeric = Array('A'..'Z') + Array('a'..'z')
63
- 10.times do
64
- alpha_numeric << ' '
65
- end
53
+ def random()
54
+ # Pour alphabet soup.
55
+ alpha_numeric = Array('A'..'Z') + Array('a'..'z')
56
+ 10.times do
57
+ alpha_numeric << ' '
58
+ end
66
59
 
67
- # Dip ladle into alphabet soup.
68
- last_char = nil
69
- sentence = Array.new(rand(@min_length..@max_length)) do |index|
70
- char = alpha_numeric.sample
71
- # Put no character next to the same character twice.
72
- while char == last_char
60
+ # Dip ladle into alphabet soup.
61
+ last_char = nil
62
+ sentence = Array.new(rand(@min_length..@max_length)) do |index|
73
63
  char = alpha_numeric.sample
64
+ # Put no character next to the same character twice.
65
+ while char == last_char
66
+ char = alpha_numeric.sample
67
+ end
68
+ last_char = char
74
69
  end
75
- last_char = char
76
- end
77
70
 
78
- return sentence.join
71
+ return sentence.join
72
+ end
79
73
 
80
74
  end
81
-
82
- end
83
75
  end
data/lib/web/index.html CHANGED
@@ -2,12 +2,11 @@
2
2
  <html>
3
3
 
4
4
  <!-- Open this file in a browser to view reflections. -->
5
- <!-- This file is tracked by git so that it shows in editors. -->
5
+ <!-- This file is tracked by Git so that it shows in text editor file browsers. -->
6
6
 
7
7
  <head>
8
8
  <meta charset="UTF-8" />
9
- <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
10
- <title>Reflekt</title>
9
+ <title>Reflections</title>
11
10
  </head>
12
11
 
13
12
  <body>
@@ -15,7 +14,7 @@
15
14
  <div id="root"></div>
16
15
 
17
16
  <noscript>
18
- You need to enable JavaScript to run this app.
17
+ You need to enable JavaScript to view reflections.
19
18
  </noscript>
20
19
 
21
20
  <script src="db.js"></script>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reflekt
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.9
4
+ version: 1.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maedi Prichard
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-15 00:00:00.000000000 Z
11
+ date: 2021-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rowdb
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: lit-cli
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  description: Testing that's completely automated.
28
42
  email: maediprichard@gmail.com
29
43
  executables: []
@@ -66,7 +80,7 @@ files:
66
80
  - lib/web/package-lock.json
67
81
  - lib/web/package.json
68
82
  - lib/web/server.js
69
- homepage: https://github.com/refIekt/reflekt
83
+ homepage: https://reflekt.dev
70
84
  licenses:
71
85
  - MPL-2.0
72
86
  metadata: {}