class ObfuscatedMorseCode::FileParser
Constants
- FileNotFoundError
Attributes
file_path[R]
Public Class Methods
new(file_path)
click to toggle source
# File lib/obfuscated_morse_code/file_parser.rb, line 7 def initialize(file_path) @file_path = file_path end
Public Instance Methods
parse()
click to toggle source
# File lib/obfuscated_morse_code/file_parser.rb, line 11 def parse File.open(file_path).reduce([], &:<<).map(&:strip) rescue Errno::ENOENT raise FileNotFoundError, "Couldn't locate file: '#{file_path}'" end