Class: Seahorse::Client::PluginList::PluginWrapper Private
- Inherits:
-
Object
- Object
- Seahorse::Client::PluginList::PluginWrapper
- Defined in:
- lib/seahorse/client/plugin_list.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
A utility class that computes the canonical name for a plugin and defers requiring the plugin until the plugin class is required.
Instance Attribute Summary collapse
- #canonical_name ⇒ String readonly private
Class Method Summary collapse
-
.new(plugin) ⇒ Object
private
Returns the given plugin if it is already a PluginWrapper.
Instance Method Summary collapse
- #eql?(other) ⇒ Boolean private
- #hash ⇒ String private
-
#initialize(plugin) ⇒ PluginWrapper
constructor
private
A new instance of PluginWrapper.
- #plugin ⇒ Class<Plugin> private
Constructor Details
#initialize(plugin) ⇒ PluginWrapper
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of PluginWrapper.
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/seahorse/client/plugin_list.rb', line 84 def initialize(plugin) case plugin when Module @canonical_name = plugin.name || plugin.object_id @plugin = plugin when Symbol, String words = plugin.to_s.split('.') @canonical_name = words.pop @gem_name = words.empty? ? nil : words.join('.') @plugin = nil else @canonical_name = plugin.object_id @plugin = plugin end end |
Instance Attribute Details
#canonical_name ⇒ String (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
101 102 103 |
# File 'lib/seahorse/client/plugin_list.rb', line 101 def canonical_name @canonical_name end |
Class Method Details
.new(plugin) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the given plugin if it is already a PluginWrapper.
109 110 111 112 113 114 115 |
# File 'lib/seahorse/client/plugin_list.rb', line 109 def self.new(plugin) if plugin.is_a?(self) plugin else super end end |
Instance Method Details
#eql?(other) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
119 120 121 |
# File 'lib/seahorse/client/plugin_list.rb', line 119 def eql? other canonical_name == other.canonical_name end |
#hash ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
125 126 127 |
# File 'lib/seahorse/client/plugin_list.rb', line 125 def hash canonical_name.hash end |
#plugin ⇒ Class<Plugin>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
104 105 106 |
# File 'lib/seahorse/client/plugin_list.rb', line 104 def plugin @plugin ||= require_plugin end |