Module: WpItem::Versionable

Included in:
WpItem
Defined in:
lib/common/models/wp_item/versionable.rb

Instance Method Summary collapse

Instance Method Details

#to_sString


23
24
25
26
# File 'lib/common/models/wp_item/versionable.rb', line 23

def to_s
  item_version = self.version
  "#@name#{' - v' + item_version.strip if item_version}"
end

#versionString

Get the version from the readme.txt


11
12
13
14
15
16
17
18
19
20
# File 'lib/common/models/wp_item/versionable.rb', line 11

def version
  unless @version
    # This check is needed because readme_url can return nil
    if has_readme?
      response = Browser.get(readme_url)
      @version = response.body[%r{(?:stable tag|version): #{WpVersion.version_pattern}}i, 1]
    end
  end
  @version
end