class Dummer::Generator::InputMode
Public Class Methods
message_proc(input)
click to toggle source
# File lib/dummer/generator/input_mode.rb, line 4 def self.message_proc(input) messages = nil begin open(input) do |in_file| messages = in_file.readlines end rescue Errno::ENOENT raise ConfigError.new("Input file `#{input}` is not readable") end idx = -1 size = messages.size Proc.new { idx = (idx + 1) % size messages[idx] } end
record_proc(input)
click to toggle source
# File lib/dummer/generator/input_mode.rb, line 21 def self.record_proc(input) # ToDo: implement parser message_proc = message_proc(input) Proc.new { { "message" => message_proc.call } } end