Class: Spina::Plugin

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/spina/plugin.rb', line 4

def name
  @name
end

#namespaceObject

Returns the value of attribute namespace.



4
5
6
# File 'lib/spina/plugin.rb', line 4

def namespace
  @namespace
end

Class Method Details

.allObject



8
9
10
# File 'lib/spina/plugin.rb', line 8

def all
  ::Spina::PLUGINS
end

.find_by_name(name) ⇒ Object



12
13
14
# File 'lib/spina/plugin.rb', line 12

def find_by_name(name)
  all.find { |plugin| plugin.name == name }
end

.register {|plugin| ... } ⇒ Object

Yields:

  • (plugin)


16
17
18
19
20
21
22
23
# File 'lib/spina/plugin.rb', line 16

def register
  plugin = new
  yield plugin
  raise 'Missing plugin name' if plugin.name.nil?
  raise 'Missing plugin namespace' if plugin.namespace.nil?
  all << plugin
  plugin
end