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.
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/seahorse/client/plugin_list.rb', line 86 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.
103 104 105 |
# File 'lib/seahorse/client/plugin_list.rb', line 103 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.
111 112 113 114 115 116 117 |
# File 'lib/seahorse/client/plugin_list.rb', line 111 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.
121 122 123 |
# File 'lib/seahorse/client/plugin_list.rb', line 121 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.
127 128 129 |
# File 'lib/seahorse/client/plugin_list.rb', line 127 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.
106 107 108 |
# File 'lib/seahorse/client/plugin_list.rb', line 106 def plugin @plugin ||= require_plugin end |