Skip to content

Commit

Permalink
defaulting nil uri scheme to file for opening xsd files. resolves mov…
Browse files Browse the repository at this point in the history
  • Loading branch information
cjavdev committed Apr 22, 2014
1 parent 454efb1 commit 37c9221
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions lib/rxsd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#
# Copyright (C) 2010 Mohammed Morsi <movitto@yahoo.com>
# See COPYING for the License of this software
require 'debugger'

lib = File.dirname(__FILE__)

Expand Down
6 changes: 3 additions & 3 deletions lib/rxsd/loader.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# RXSD resource loader
# RXSD resource loader
#
# Copyright (C) 2010 Mohammed Morsi <movitto@yahoo.com>
# See COPYING for the License of this software
Expand All @@ -13,10 +13,10 @@ class Loader

# loads and return text resource from specified source uri
def self.load(source_uri)
Logger.info "loading resource from uri #{source_uri}"
Logger.info "loading resource from uri #{source_uri}"
data = nil
uri = URI.parse(source_uri)
if uri.scheme == "file"
if uri.scheme == "file" || uri.scheme.nil?
data = File.read_all uri.path
elsif uri.scheme == "http"
data = Net::HTTP.get_response(uri.host, uri.path).body
Expand Down
2 changes: 1 addition & 1 deletion lib/rxsd/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
# See COPYING for the License of this software

module RXSD

# Provides class methods to parse xsd and xml data
class Parser
private
Expand All @@ -18,6 +17,7 @@ def initialize
# * :uri location which to load resource from
# * :raw raw data which to parse
def self.parse_xsd(args)
debugger
data = Loader.load(args[:uri]) unless args[:uri].nil?
data = args[:raw] unless args[:raw].nil?
Logger.debug "parsing xsd"
Expand Down

0 comments on commit 37c9221

Please sign in to comment.