lib/io_streams/tabular.rb in iostreams-0.19.0 vs lib/io_streams/tabular.rb in iostreams-0.20.0
- old
+ new
@@ -64,11 +64,11 @@
@parser = format_options ? klass.new(format_options) : klass.new
end
# Returns [true|false] whether a header is still required in order to parse or render the current format.
def header?
- parser.requires_header? && IOStreams.blank?(header.columns)
+ parser.requires_header? && IOStreams::Utils.blank?(header.columns)
end
# Returns [true|false] whether a header row show be rendered on output.
def requires_header?
parser.requires_header?
@@ -79,11 +79,11 @@
#
# Notes:
# * Call `header?` first to determine if the header should be parsed first.
# * The header columns are set after parsing the row, but the header is not cleansed.
def parse_header(line)
- return if IOStreams.blank?(line) || !parser.requires_header?
+ return if IOStreams::Utils.blank?(line) || !parser.requires_header?
header.columns = parser.parse(line)
end
# Returns [Hash<String,Object>] the line as a hash.
@@ -94,27 +94,27 @@
end
# Returns [Array] the row/line as a parsed Array of values.
# Returns nil if the row/line is blank.
def row_parse(line)
- return if IOStreams.blank?(line)
+ return if IOStreams::Utils.blank?(line)
parser.parse(line)
end
# Renders the output row
def render(row)
- return if IOStreams.blank?(row)
+ return if IOStreams::Utils.blank?(row)
parser.render(row, header)
end
# Returns [String] the header rendered for the output format
# Return nil if no header is required.
def render_header
return unless requires_header?
- if IOStreams.blank?(header.columns)
+ if IOStreams::Utils.blank?(header.columns)
raise(Errors::MissingHeader, "Header columns must be set before attempting to render a header for format: #{format.inspect}")
end
parser.render(header.columns, header)
end