text-gen 0.4.1 → 0.4.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/lib/text/gen/runner.rb +3 -3
- data/lib/text/gen/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 774c55a03bef5a73d7064ec5ed93d5a4b6d5c3848cec572e609281fd3f6605e8
|
|
4
|
+
data.tar.gz: 4b9c9c7f2d67dd926b904b088d3fdbaeaba222ad6bb5ede5ae4e2ac4c130589b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bb081e34e4013a9d850b4f93131de88426179f5dc953641753a81afe9a7e9892317f245b700d57d4a1a7ce1e716132bade08cc55805db398f3039e5688d413cf
|
|
7
|
+
data.tar.gz: 10f962fb737618a856fe8320e40fc740931bed0fd10b076df01abf6996ad020c7e3ab8a5e2212f8c09e4314367ca4dc643238c1eb3a1a0f2de118fe8e7e5b762
|
data/lib/text/gen/runner.rb
CHANGED
|
@@ -102,17 +102,17 @@ module Text
|
|
|
102
102
|
rand_weight = rand(total_weight)
|
|
103
103
|
current_weight = 0
|
|
104
104
|
item = items.find do |item|
|
|
105
|
-
current_weight += item
|
|
105
|
+
current_weight += item.fetch("weight", 1).to_i
|
|
106
106
|
current_weight > rand_weight
|
|
107
107
|
end
|
|
108
|
+
return unless item
|
|
109
|
+
|
|
108
110
|
result = run_item(item, depth)
|
|
109
111
|
result.merge_meta(meta)
|
|
110
112
|
result
|
|
111
113
|
end
|
|
112
114
|
|
|
113
115
|
def run_item(item, depth)
|
|
114
|
-
return unless item
|
|
115
|
-
|
|
116
116
|
locale_item = Filter.replace_locale(item, locale)
|
|
117
117
|
item = locale_item || item
|
|
118
118
|
|
data/lib/text/gen/version.rb
CHANGED