@param [ URI ] target_base_uri @param [ Hash ] options See allowed_option
@return [ WpItem ]
# File lib/common/models/wp_item.rb, line 31 def initialize(target_base_uri, options = {}) options[:wp_content_dir] ||= 'wp-content' options[:wp_plugins_dir] ||= options[:wp_content_dir] + '/plugins' set_options(options) forge_uri(target_base_uri) end
@param [ WpItem ] other
# File lib/common/models/wp_item.rb, line 88 def <=>(other) name <=> other.name end
@param [ WpItem ] other
# File lib/common/models/wp_item.rb, line 93 def ==(other) name === other.name end
@param [ WpItem ] other
# File lib/common/models/wp_item.rb, line 98 def ===(other) self == other && version === other.version end
@return [ Array ] Make it private ?
# File lib/common/models/wp_item.rb, line 23 def allowed_options [:name, :wp_content_dir, :wp_plugins_dir, :path, :version, :vulns_file] end
@param [ URI ] target_base_uri
@return [ void ]
# File lib/common/models/wp_item.rb, line 61 def forge_uri(target_base_uri) @uri = target_base_uri end
Sets the #found_from attribute
@param [ String ] method The method which found the WpItem
@return [ void ]
# File lib/common/models/wp_item/findable.rb, line 10 def found_from=(method) found = method[%r{find_from_(.*)}, 1] @found_from = found.gsub('_', ' ') if found end
Sets the path
Variable, such as $wp-plugins$ and $wp-content$ can be used and will be replace by their value
@param [ String ] path
@return [ void ]
# File lib/common/models/wp_item.rb, line 81 def path=(path) @path = URI.encode( path.gsub(/\$wp-plugins\$/, wp_plugins_dir).gsub(/\$wp-content\$/, wp_content_dir) ) end
@return [ String ] The url to the WpItem
# File lib/common/models/wp_item.rb, line 71 def url; uri.to_s end