Class: Descartes

Inherits:
Object
  • Object
show all
Defined in:
lib/descartes/version.rb,
lib/descartes/descartes.rb,
lib/descartes/modules/rpn.rb,
lib/descartes/modules/url.rb,
lib/descartes/modules/seen.rb,
lib/descartes/modules/pigro.rb,
lib/descartes/modules/reply.rb,
lib/descartes/modules/azzone.rb,
lib/descartes/modules/google.rb,
lib/descartes/modules/lastfm.rb,
lib/descartes/modules/shinbo.rb,
lib/descartes/modules/dicteng.rb,
lib/descartes/modules/quotone.rb,
lib/descartes/modules/sindaco.rb,
lib/descartes/modules/currency.rb,
lib/descartes/modules/reminder.rb,
lib/descartes/modules/tangorin.rb,
lib/descartes/modules/treccani.rb,
lib/descartes/modules/hackernews.rb,
lib/descartes/modules/crunchyroll.rb,
lib/descartes/modules/musicthoughts.rb

Overview

DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE

Version 2, December 2004

Everyone is permitted to copy and distribute verbatim or modified copies of this license document, and changing it is allowed as long as the name is changed.

          DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
 TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

0. You just DO WHAT THE FUCK YOU WANT TO.

Defined Under Namespace

Classes: Azzone, Crunchybot, Currency, Dicteng, Google, Hackernews, LastFm, MusicToughts, Pigro, Quotone, RPN, Reminder, Reply, Seen, Shinbo, Sindaco, Tangorin, Treccani, Url

Class Method Summary collapse

Class Method Details

.each_moduleObject



17
18
19
20
21
22
# File 'lib/descartes/descartes.rb', line 17

def each_module
  Dir.glob(File.expand_path('../modules/*.rb', __FILE__)).map do |plugin|
    name = File.basename(plugin, '.rb')
    yield plugin, name unless name == 'VERSION'
  end
end

.load(options = {}) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/descartes/descartes.rb', line 24

def load(options = {})
  $options = options
  $options[:exclude] ||= []

  puts 'Importing modules..'
  each_module do |plugin, name|
    if $options[:exclude].include?(name)
      puts "- Skipping #{name}..."
    else
      print "- Loading #{name}..."
      require plugin
      puts ' done'
    end
  end

  [].tap do |plugins|
    Descartes.constants.map do |name|
      plugin = "Descartes::#{name}".split('::').inject(Object) { |o, c| o.const_get c }
      plugins << plugin if plugin.is_a?(Class) && plugin.include?(Cinch::Plugin)
    end
  end
end