Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Remove begin in parse_source()

The begin here wasn't needed because of the structure of a function
definition.
  • Loading branch information...
commit 96dafc9b2c8e414220707ffe4c5cc4587ac3ba3c 1 parent 912bd6e
@LawrenceWoodman authored
Showing with 17 additions and 19 deletions.
  1. +17 −19 bin/mida
View
36 bin/mida
@@ -92,30 +92,28 @@ end
def parse_source(source, options)
url = get_url
- begin
- open(source) do |f|
- doc = Mida::Document.new(f, url)
- items = if options[:type]
- doc.search(options[:type])
- else
- doc.items
- end
+ open(source) do |f|
+ doc = Mida::Document.new(f, url)
+ items = if options[:type]
+ doc.search(options[:type])
+ else
+ doc.items
+ end
- if items.empty?
- puts "No microdata found in this document."; exit
+ if items.empty?
+ puts "No microdata found in this document."; exit
+ else
+ if options.include?(:count)
+ display_count(items)
else
- if options.include?(:count)
- display_count(items)
- else
- display_items(items)
- end
+ display_items(items)
end
end
- rescue => e
- puts "Failed to parse: #{source}"
- puts "Error: #{e.to_s}"
- exit
end
+rescue => e
+ puts "Failed to parse: #{source}"
+ puts "Error: #{e.to_s}"
+ exit
end
ARGV.each do |source|
Please sign in to comment.
Something went wrong with that request. Please try again.