Class: Spigoter::Plugin

Inherits:
Object
  • Object
show all
Defined in:
lib/spigoter/webapi/plugin.rb

Overview

Generalized plugin.

Author:

Direct Known Subclasses

PluginBukkit, PluginCurse, PluginSpigot

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(website) ⇒ Plugin

Returns a new instance of Plugin.



8
9
10
11
12
13
14
15
16
17
# File 'lib/spigoter/webapi/plugin.rb', line 8

def initialize(website)
  @url = website # Url of the plugin
  # @main_page     # Mainpage content
  # @name          # Name of the plugin
  # @download_page # Content of the download page
  # @download_url  # Download url of the plugin
  # @regexp        # Regexp that matches the URL
  # @file          # Where the file is stored
  main_page # preload main_page
end

Class Method Details

.listObject



33
34
35
36
37
38
39
# File 'lib/spigoter/webapi/plugin.rb', line 33

def self.list
  {
    curse: Spigoter::PluginCurse,
    devbukkit: Spigoter::PluginBukkit,
    spigot: Spigoter::PluginSpigot
  }
end

Instance Method Details

#download_urlObject



24
25
26
# File 'lib/spigoter/webapi/plugin.rb', line 24

def download_url
  @url # Dummy method, just to test
end

#fileObject



28
29
30
31
# File 'lib/spigoter/webapi/plugin.rb', line 28

def file
  return @file unless @file.nil?
  @file = Spigoter::Utils.download(download_url) # download_url is implemented in child class
end

#main_pageObject



19
20
21
22
# File 'lib/spigoter/webapi/plugin.rb', line 19

def main_page
  return @main_page unless @main_page.nil?
  @main_page = Spigoter::Utils.download(@url)
end