Module: WpVersion::Findable

Included in:
WpVersion
Defined in:
lib/common/models/wp_version/findable.rb

Instance Method Summary collapse

Instance Method Details

#find(target_uri, wp_content_dir, wp_plugins_dir, versions_xml) ⇒ WpVersion

Find the version of the blog designated from target_uri

Parameters:

  • target_uri (URI)
  • wp_content_dir (String)
  • wp_plugins_dir (String)

Returns:


14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/common/models/wp_version/findable.rb', line 14

def find(target_uri, wp_content_dir, wp_plugins_dir, versions_xml)
  methods.grep(/^find_from_/).each do |method|

    if method === :find_from_advanced_fingerprinting
      version = send(method, target_uri, wp_content_dir, wp_plugins_dir, versions_xml)
    else
      version = send(method, target_uri)
    end

    if version
      return new(target_uri, number: version, found_from: method)
    end
  end
  nil
end

#version_patternString

Used to check if the version is correct: must contain at least one dot.

Returns:

  • (String)

33
34
35
# File 'lib/common/models/wp_version/findable.rb', line 33

def version_pattern
  '([^\r\n"\']+\.[^\r\n"\']+)'
end