my_first_markov 0.0.1 → 0.0.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/my_first_markov.rb +1 -0
- data/lib/my_first_markov/chain.rb +2 -4
- data/lib/my_first_markov/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8b6a08834fbbc7a6062885517e7288865901c91
|
4
|
+
data.tar.gz: 609072cc5f6d1d661e668a93ae3c8399c4483595
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49998299be2bee0c59d3916b341043a97d26e17e32e3e8c0af13f94d33ade05f781f518154bfbcd3eacacfa6a71953c0291f40fa2f630acee729eaacb53bfa12
|
7
|
+
data.tar.gz: 17eb6a296ebe795f099fa5f4ff581e77533d6f4d13a87bb3535e5e5c81415dffd74454dd1fd6b4d06ac0322f1f47c45266a0b3de7a2f1159494919817c056781
|
data/bin/my_first_markov.rb
CHANGED
@@ -29,5 +29,6 @@ if File.basename(__FILE__) == File.basename($PROGRAM_NAME)
|
|
29
29
|
exit
|
30
30
|
end
|
31
31
|
|
32
|
+
puts "calling MyFirstMarkov::Chain.from_file(#{file}, #{split_on.inspect}, #{starting_entry.inspect}, #{next_method.inspect})"
|
32
33
|
puts MyFirstMarkov::Chain.from_file(file, split_on, starting_entry, next_method)
|
33
34
|
end
|
@@ -21,22 +21,20 @@ module MyFirstMarkov
|
|
21
21
|
unless split_on && MyFirstMarkov::Chain.split_on_values.include?(split_on.downcase)
|
22
22
|
split_on = MyFirstMarkov::Chain.default_split_on_value
|
23
23
|
end
|
24
|
-
split_on.downcase!
|
25
24
|
|
26
25
|
unless next_method && MyFirstMarkov::Chain.next_methods.include?(next_method.downcase)
|
27
26
|
next_method = MyFirstMarkov::Chain.default_next_method
|
28
27
|
end
|
29
|
-
next_method.downcase!
|
30
28
|
|
31
29
|
unless File.exists?(file)
|
32
30
|
fail("Unknown file: #{file.inspect}")
|
33
31
|
end
|
34
32
|
|
35
33
|
data = File.read(file)
|
36
|
-
("word" == split_on) ? entries = data.split : entries = data.split(//)
|
34
|
+
("word" == split_on.downcase) ? entries = data.split : entries = data.split(//)
|
37
35
|
entries ||= []
|
38
36
|
|
39
|
-
new(entries).send(next_method, starting_entry)
|
37
|
+
new(entries).send(next_method.downcase, starting_entry)
|
40
38
|
end
|
41
39
|
|
42
40
|
def initialize(ordered_list)
|