Sha256: fbb9c620168d0a348c4366db4150c1964f5152f19bf2ea68714db1a98aa81030

Contents?: true

Size: 487 Bytes

Versions: 1

Compression:

Stored size: 487 Bytes

Contents

module Hari
  module Scripts

    SCRIPT_PATH = File.expand_path('../scripts', __FILE__)

    def map
      @scripts ||= {}
    end

    def load
      files = Dir[SCRIPT_PATH.join('**/*.lua')]

      files.each do |file|
        name   = file.gsub("#{SCRIPT_PATH}/", '').gsub('.lua', '')
        script = File.read(file)
        sha    = Hari.redis.script(:load, script)
        map[name] = sha
      end
    end

    def sha(script_name)
      map[script_name.to_s]
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hari-0.0.1 lib/hari/scripts.rb