dunmanifestin 1.0.1 → 1.1.2
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/bin/dunmanifestin +2 -2
- data/lib/dunmanifestin/array.rb +21 -8
- data/lib/dunmanifestin/integer.rb +6 -0
- data/lib/dunmanifestin/phrase.rb +4 -1
- data/lib/dunmanifestin/terminator.rb +3 -3
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 934eb3422c194a6dd594aeabeb0463c06f79d8d1df3900ddbaf5ff891369abd4
|
4
|
+
data.tar.gz: ffb693990eead59ae574e5b90520aaad3fb3893b931e2d69733cf61dfe5f39f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e23c747b18b8de4e6315ec97beb2a3c179bc1c72144344c23c5bda325e58457353e77f67b1023a142cdc4df701fecb4709b97eb05f6c1952538f40e757f7229e
|
7
|
+
data.tar.gz: 7189eed17e6daf22aa608293243ded14113ea1ce26d2156af8d8f2b974ba278c8801ecaa453a2a45e6536ee9fd3e6699da8652bb30f5821d4f46269dd3a405e1
|
data/bin/dunmanifestin
CHANGED
@@ -12,8 +12,8 @@ user_demands = Optimist::options do
|
|
12
12
|
opt :phrase, "Specify a phrase or list, e.g. 'The [animal] sat on the [article]' or '[weapon]'", type: :string, short: '-p'
|
13
13
|
opt :chomp, "remove the trailing newline from the output", short: '-o'
|
14
14
|
opt :file, "Read a file as the phrase", type: :string, short: '-f'
|
15
|
-
opt :coarse_seed, "
|
16
|
-
opt :fine_seed, "
|
15
|
+
opt :coarse_seed, "Set this number to encourage phrases to resolve somewhat predictably", type: :integer, short: "-s"
|
16
|
+
opt :fine_seed, "Set this number (alongside -s) to lock phrases into resolving completely predictably", type: :integer, short: "-e"
|
17
17
|
end
|
18
18
|
|
19
19
|
begin
|
data/lib/dunmanifestin/array.rb
CHANGED
@@ -1,13 +1,26 @@
|
|
1
|
-
|
2
|
-
RECCURENCES = 5
|
3
|
-
COARSE_SEED ||= rand(NUM_DEFAULT_REGIONS)
|
4
|
-
FINE_SEED ||= nil
|
5
|
-
|
6
|
-
META_RANDOM = FINE_SEED ? Random.new(FINE_SEED) : Random.new
|
7
|
-
RANDOMS = RECCURENCES.times.map { Random.new(COARSE_SEED) }
|
1
|
+
require_relative 'integer'
|
8
2
|
|
9
3
|
class Array
|
10
|
-
|
4
|
+
RECCURENCES = 500
|
5
|
+
|
6
|
+
class << self
|
7
|
+
attr_accessor :coarse_seed, :fine_seed, :diversity
|
8
|
+
|
9
|
+
def meta_random
|
10
|
+
@meta_random ||= @fine_seed ? Random.new(@fine_seed) : Random.new
|
11
|
+
end
|
12
|
+
|
13
|
+
def randoms
|
14
|
+
@coarse_seed ||= meta_random.rand(Integer::MAX)
|
15
|
+
@randoms ||= RECCURENCES.times.map do |i|
|
16
|
+
Random.new(@coarse_seed + i % @diversity)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def constrained_sample(randoms: Array.randoms, meta_random: Array.meta_random)
|
22
|
+
# $count ||= 1
|
23
|
+
# p $count += 1
|
11
24
|
self.sample(
|
12
25
|
1,
|
13
26
|
random: randoms.sample(1, random: meta_random).pop
|
data/lib/dunmanifestin/phrase.rb
CHANGED
@@ -136,7 +136,10 @@ class Phrase
|
|
136
136
|
|
137
137
|
delegates = @inflection_delegates[inflection]
|
138
138
|
delegates.each { |delegate| variables[delegate].inflect inflection }
|
139
|
-
|
139
|
+
self
|
140
|
+
rescue NoMethodError
|
141
|
+
puts "==> Failed to inflect: .#{inflection}?"
|
142
|
+
puts "==> Valid inflections are: plural, possessive, article, capitalize, titleize"
|
140
143
|
self
|
141
144
|
end
|
142
145
|
|
@@ -9,9 +9,9 @@ class Terminator
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def address demands
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
Array.coarse_seed = demands[:coarse_seed]
|
13
|
+
Array.fine_seed = demands[:fine_seed]
|
14
|
+
Array.diversity = 5
|
15
15
|
phrase_string = phrasing(demands[:phrase], demands[:file])
|
16
16
|
root_phrase_class = Class.new(Phrase) { list phrase_string, !!demands[:file] }
|
17
17
|
list_loader.load demands[:genre]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dunmanifestin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- quavmo
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2019-04-
|
13
|
+
date: 2019-04-02 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
@@ -100,6 +100,7 @@ files:
|
|
100
100
|
- lib/dunmanifestin/array.rb
|
101
101
|
- lib/dunmanifestin/custom_inflections.rb
|
102
102
|
- lib/dunmanifestin/generator.rb
|
103
|
+
- lib/dunmanifestin/integer.rb
|
103
104
|
- lib/dunmanifestin/list.rb
|
104
105
|
- lib/dunmanifestin/list_loader.rb
|
105
106
|
- lib/dunmanifestin/manifestation.rb
|