lib/io_streams/builder.rb in iostreams-1.6.2 vs lib/io_streams/builder.rb in iostreams-1.7.0

- old
+ new

@@ -95,19 +95,21 @@ def format @format ||= file_name ? Tabular.format_from_file_name(file_name) : nil end def format=(format) - raise(ArgumentError, "Invalid format: #{format.inspect}") unless format.nil? || IOStreams::Tabular.registered_formats.include?(format) + unless format.nil? || IOStreams::Tabular.registered_formats.include?(format) + raise(ArgumentError, "Invalid format: #{format.inspect}") + end @format = format end private def class_for_stream(type, stream) ext = IOStreams.extensions[stream.nil? ? nil : stream.to_sym] || - raise(ArgumentError, "Unknown Stream type: #{stream.inspect}") + raise(ArgumentError, "Unknown Stream type: #{stream.inspect}") ext.send("#{type}_class") || raise(ArgumentError, "No #{type} registered for Stream type: #{stream.inspect}") end # Returns the streams for the supplied file_name def parse_extensions