aboutsummaryrefslogtreecommitdiff
path: root/markov-generate.rb
diff options
context:
space:
mode:
Diffstat (limited to 'markov-generate.rb')
-rw-r--r--markov-generate.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/markov-generate.rb b/markov-generate.rb
index 36d80a1..4213a58 100644
--- a/markov-generate.rb
+++ b/markov-generate.rb
@@ -1,8 +1,12 @@
module Markov
class Generator
- def initialize(inputfile)
+ def initialize(input, type=:var)
@prng = Random.new(Time.now.to_i)
- @stats = Marshal::load(File.open(inputfile).read)
+ if type == :var then
+ @stats = input
+ elsif type == :file then
+ @stats = Marshal::load(File.open(input).read)
+ end
@chunklength = @stats["__SETTINGS__"]["__CHUNKLENGTH__"]
end