Class: CrazyDoll::PluginManager::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/crazy_doll/plugin_manager.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(klass) ⇒ Config

Returns a new instance of Config.



119
120
121
122
# File 'lib/crazy_doll/plugin_manager.rb', line 119

def initialize(klass)
  @klass = klass
  @gems, @plugins, @keys, @custom_messages = {}, {}, {}, []
end

Instance Attribute Details

#custom_messagesObject (readonly)

Returns the value of attribute custom_messages.



118
119
120
# File 'lib/crazy_doll/plugin_manager.rb', line 118

def custom_messages
  @custom_messages
end

#gemsObject (readonly)

Returns the value of attribute gems.



118
119
120
# File 'lib/crazy_doll/plugin_manager.rb', line 118

def gems
  @gems
end

#keysObject (readonly)

Returns the value of attribute keys.



118
119
120
# File 'lib/crazy_doll/plugin_manager.rb', line 118

def keys
  @keys
end

#pluginsObject (readonly)

Returns the value of attribute plugins.



118
119
120
# File 'lib/crazy_doll/plugin_manager.rb', line 118

def plugins
  @plugins
end

Instance Method Details

#gem(name, opts = {}) ⇒ Object



124
125
126
# File 'lib/crazy_doll/plugin_manager.rb', line 124

def gem(name, opts = {})
  @gems[name.to_sym] = opts
end

#key(name, value, description = '') ⇒ Object



132
133
134
# File 'lib/crazy_doll/plugin_manager.rb', line 132

def key(name, value, description='')
  @keys[name.to_sym] = [description, value]
end

#plugin(name, opts = {}) ⇒ Object



128
129
130
# File 'lib/crazy_doll/plugin_manager.rb', line 128

def plugin(name, opts = {})
  @plugins[name.to_sym] = opts
end

#register(name, line, method, where = [:chan, :priv], regexp = nil) ⇒ Object



136
137
138
139
140
# File 'lib/crazy_doll/plugin_manager.rb', line 136

def register(name, line, method, where=[:chan, :priv], regexp=nil)
  line = '' unless line.is_a?(String)
  line = "#{name}#{line.empty? ? '' : ' ' + line}"
  @custom_messages << [regexp || line.to_crazy_doll_regexp, line, method, [where].flatten]
end