Class: Rpush::Plugin
- Inherits:
-
Object
- Object
- Rpush::Plugin
- Defined in:
- lib/rpush/plugin.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#description ⇒ Object
Returns the value of attribute description.
-
#init_block ⇒ Object
readonly
Returns the value of attribute init_block.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
- #configure {|@config| ... } ⇒ Object
- #init(&block) ⇒ Object
-
#initialize(name) ⇒ Plugin
constructor
A new instance of Plugin.
- #reflect {|@reflection_collection| ... } ⇒ Object
- #unload ⇒ Object
Constructor Details
#initialize(name) ⇒ Plugin
Returns a new instance of Plugin.
15 16 17 18 19 20 21 22 |
# File 'lib/rpush/plugin.rb', line 15 def initialize(name) @name = name @url = nil @description = nil @config = OpenStruct.new @reflection_collection = Rpush::ReflectionCollection.new @init_block = -> {} end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
12 13 14 |
# File 'lib/rpush/plugin.rb', line 12 def config @config end |
#description ⇒ Object
Returns the value of attribute description.
13 14 15 |
# File 'lib/rpush/plugin.rb', line 13 def description @description end |
#init_block ⇒ Object (readonly)
Returns the value of attribute init_block.
12 13 14 |
# File 'lib/rpush/plugin.rb', line 12 def init_block @init_block end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
12 13 14 |
# File 'lib/rpush/plugin.rb', line 12 def name @name end |
#url ⇒ Object
Returns the value of attribute url.
13 14 15 |
# File 'lib/rpush/plugin.rb', line 13 def url @url end |
Instance Method Details
#configure {|@config| ... } ⇒ Object
30 31 32 33 |
# File 'lib/rpush/plugin.rb', line 30 def configure yield(@config) Rpush.config.plugin.send("#{@name}=", @config) end |
#init(&block) ⇒ Object
35 36 37 |
# File 'lib/rpush/plugin.rb', line 35 def init(&block) @init_block = block end |
#reflect {|@reflection_collection| ... } ⇒ Object
24 25 26 27 28 |
# File 'lib/rpush/plugin.rb', line 24 def reflect yield(@reflection_collection) return if Rpush.reflection_stack.include?(@reflection_collection) Rpush.reflection_stack << @reflection_collection end |
#unload ⇒ Object
39 40 41 42 |
# File 'lib/rpush/plugin.rb', line 39 def unload Rpush.reflection_stack.delete(@reflection_collection) Rpush.config.plugin.send("#{name}=", nil) end |