Sha256: f0261f1a73508c2d5f27984544ffa4d1a9b1b148fb2dc751fed1da11f5465ae4

Contents?: true

Size: 479 Bytes

Versions: 5

Compression:

Stored size: 479 Bytes

Contents

module Boty
  class ScriptLoader
    def initialize(bot)
      @dsl = ScriptDSL.new bot
    end

    def load
      scripts_to_load.each do |file|
        @dsl.instance_eval File.read(file), file, 1
      end
    end

    private

    def scripts_to_load
      default_scripts_path = File.expand_path("../../../script", __FILE__)
      paths = Dir["script/**/*.rb"] + Dir["#{default_scripts_path}/**/*.rb"]
      paths.map { |file| File.expand_path file }.uniq
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
boty-0.0.17.1 lib/boty/script_loader.rb
boty-0.0.17 lib/boty/script_loader.rb
boty-0.0.16 lib/boty/script_loader.rb
boty-0.0.15 lib/boty/script_loader.rb
boty-0.0.14 lib/boty/script_loader.rb