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 |
# 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 @canonical_name, @gem_name = plugin.to_s.split('.').reverse @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.
99 100 101 |
# File 'lib/seahorse/client/plugin_list.rb', line 99 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.
107 108 109 110 111 112 113 |
# File 'lib/seahorse/client/plugin_list.rb', line 107 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.
117 118 119 |
# File 'lib/seahorse/client/plugin_list.rb', line 117 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.
123 124 125 |
# File 'lib/seahorse/client/plugin_list.rb', line 123 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.
102 103 104 |
# File 'lib/seahorse/client/plugin_list.rb', line 102 def plugin @plugin ||= require_plugin end |