Module: Marmalade
- Defined in:
- lib/marmalade.rb,
lib/marmalade/puzzle.rb,
lib/marmalade/version.rb,
lib/marmalade/file_reader.rb
Defined Under Namespace
Classes: FileReader, Puzzle
Constant Summary collapse
- VERSION =
"0.0.4"
Class Method Summary collapse
Class Method Details
.jam(options = {}, &block) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/marmalade.rb', line 16 def self.jam( = {}, &block) = .merge() begin file_name = [:file] unless File.exist?(file_name) raise MarmaladeError.new("Cannot find input file #{file_name}") end File.open(file_name, 'r') do |file| reader = FileReader.new(file) puzzle = Puzzle.new(reader, ) puzzle.instance_eval(&block) end rescue MarmaladeError => e puts "** Error: #{e.}" end end |