Sha256: 4f954671f5021538e990b99b4a2f276fbd451640d82632ca26a34dc3440a99b3

Contents?: true

Size: 473 Bytes

Versions: 6

Compression:

Stored size: 473 Bytes

Contents

module Boty
  class ScriptLoader
    def initialize(bot)
      @dsl = DSL.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

6 entries across 6 versions & 1 rubygems

Version Path
boty-1.0.1 lib/boty/script_loader.rb
boty-1.0.0 lib/boty/script_loader.rb
boty-0.2.0 lib/boty/script_loader.rb
boty-0.1.2 lib/boty/script_loader.rb
boty-0.1.1 lib/boty/script_loader.rb
boty-0.1.0 lib/boty/script_loader.rb