lib/ronin/url.rb in ronin-1.0.0.rc1 vs lib/ronin/url.rb in ronin-1.0.0.rc2
- old
+ new
@@ -15,23 +15,23 @@
#
# You should have received a copy of the GNU General Public License
# along with Ronin. If not, see <http://www.gnu.org/licenses/>.
#
-require 'ronin/url_scheme'
-require 'ronin/url_query_param'
-require 'ronin/host_name'
-require 'ronin/tcp_port'
-require 'ronin/web_credential'
require 'ronin/model'
require 'dm-timestamps'
-require 'dm-tags'
require 'uri'
require 'uri/query_params'
module Ronin
+ autoload :URLScheme, 'ronin/url_scheme'
+ autoload :URLQueryParam, 'ronin/url_query_param'
+ autoload :HostName, 'ronin/host_name'
+ autoload :TCPPort, 'ronin/tcp_port'
+ autoload :WebCredential, 'ronin/web_credential'
+
#
# Represents URLs that can be stored in the {Database}.
#
class URL
@@ -73,13 +73,10 @@
property :last_scanned_at, Time
# Defines the created_at timestamp
timestamps :created_at
- # Tags
- has_tags_on :tags
-
#
# Searches for all URLs using HTTP.
#
# @return [Array<URL>]
# The matching URLs.
@@ -205,10 +202,12 @@
#
def self.[](url)
return super(url) if url.kind_of?(Integer)
# optionally parse the URL
- url = ::URI.parse(url) unless url.kind_of?(::URI)
+ unless url.kind_of?(::URI)
+ url = ::URI.parse(url.to_s)
+ end
port = if url.port
{:number => url.port}
end