Class: Spigoter::PluginSpigot
- Defined in:
- lib/spigoter/webapi/spigot.rb
Overview
Class that represent a devBukkit plugin.
Instance Method Summary collapse
- #download_url ⇒ Object
-
#initialize(website) ⇒ PluginSpigot
constructor
A new instance of PluginSpigot.
- #name ⇒ Object
- #version ⇒ Object
Methods inherited from Plugin
Constructor Details
#initialize(website) ⇒ PluginSpigot
Returns a new instance of PluginSpigot.
8 9 10 11 |
# File 'lib/spigoter/webapi/spigot.rb', line 8 def initialize(website) raise "Bad URL #{website}" if website.match(%r{https://www.spigotmc.org/resources/[a-z0-9\-]+/?}).nil? super(website) end |
Instance Method Details
#download_url ⇒ Object
13 14 15 16 17 |
# File 'lib/spigoter/webapi/spigot.rb', line 13 def download_url return @download_url unless @download_url.nil? uri = /<a href="(?<download_url>resources.+)" class="inner">/.match(@main_page)[:download_url] @download_url = "https://www.spigotmc.org/#{uri}" end |
#name ⇒ Object
24 25 26 27 |
# File 'lib/spigoter/webapi/spigot.rb', line 24 def name return @name unless @name.nil? @name = /<h1>(?<name>.+?)\s*<span class="muted">/.match(@main_page)[:name] end |
#version ⇒ Object
19 20 21 22 |
# File 'lib/spigoter/webapi/spigot.rb', line 19 def version return @version unless @version.nil? @version = %r{class="muted">(?<version>.+)</span>}.match(@main_page)[:version] end |