Module: OpenBEL::Plugin

Included in:
CacheKyotoCabinet, Nanopub
Defined in:
lib/openbel/api/plugin/plugin.rb,
lib/openbel/api/plugin/nanopub/nanopub.rb,
lib/openbel/api/plugin/cache/kyotocabinet.rb

Defined Under Namespace

Classes: CacheKyotoCabinet, Nanopub, ValidationError

Constant Summary collapse

EMPTY_ARRAY =
[].freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/openbel/api/plugin/plugin.rb', line 9

def self.included(base)
  INCLUSION_MUTEX.lock
  begin
    unless OpenBEL.const_defined?(:PluginClasses)
      OpenBEL.const_set(:PluginClasses, [])
    end
    OpenBEL::PluginClasses << base
  ensure
    INCLUSION_MUTEX.unlock
  end
end

Instance Method Details

#<=>(other) ⇒ Object



57
58
59
60
61
# File 'lib/openbel/api/plugin/plugin.rb', line 57

def <=>(other)
  id_compare = id.to_s <=> other.to_s
  return id_compare unless id_compare == 0
  return self.name.to_s <=> other.name.to_s
end

#==(other) ⇒ Object Also known as: eql?



67
68
69
70
71
# File 'lib/openbel/api/plugin/plugin.rb', line 67

def ==(other)
  return false if other == nil
  return true if self.equal? other
  self.id == other.id && self.name == other.name
end

#configure(extensions = {}, options = {}) ⇒ Object



51
# File 'lib/openbel/api/plugin/plugin.rb', line 51

def configure(extensions = {}, options = {}); end

#create_instanceObject



53
# File 'lib/openbel/api/plugin/plugin.rb', line 53

def create_instance; end

#descriptionObject



29
30
31
# File 'lib/openbel/api/plugin/plugin.rb', line 29

def description
  fail NotImplementedError.new("#{__method__} not implemented")
end

#hashObject



63
64
65
# File 'lib/openbel/api/plugin/plugin.rb', line 63

def hash
  [id, name].hash
end

#idObject



21
22
23
# File 'lib/openbel/api/plugin/plugin.rb', line 21

def id
  fail NotImplementedError.new("#{__method__} not implemented")
end

#nameObject



25
26
27
# File 'lib/openbel/api/plugin/plugin.rb', line 25

def name
  fail NotImplementedError.new("#{__method__} not implemented")
end

#on_loadObject



49
# File 'lib/openbel/api/plugin/plugin.rb', line 49

def on_load; end

#on_unloadObject



55
# File 'lib/openbel/api/plugin/plugin.rb', line 55

def on_unload; end

#optional_extensionsObject



41
42
43
# File 'lib/openbel/api/plugin/plugin.rb', line 41

def optional_extensions
  []
end

#required_extensionsObject



37
38
39
# File 'lib/openbel/api/plugin/plugin.rb', line 37

def required_extensions
  []
end

#typeObject



33
34
35
# File 'lib/openbel/api/plugin/plugin.rb', line 33

def type
  fail NotImplementedError.new("#{__method__} not implemented.")
end

#validate(extensions = {}, options = {}) ⇒ Object



45
46
47
# File 'lib/openbel/api/plugin/plugin.rb', line 45

def validate(extensions = {}, options = {})
  validation_successful
end