Sha256: b296a410528e714e766bb8662475264d8e2d1ecb4970d9f617b65c3b3fe3b3c1

Contents?: true

Size: 577 Bytes

Versions: 1

Compression:

Stored size: 577 Bytes

Contents

module Kernel
  def gen_code(size = 8)
    rand(36**size).to_s(36)
  end
end

module CEML
  class Delegate
    LOCATIONS = {}
    PLAYERS   = {}

    # yields thing w. #keys, #each, #[], #[]=
    def with_players id
      yield PLAYERS[id] ||= {}
    end

    # yields a thing with #each and #<<
    def with_locations script
      yield LOCATIONS[script] ||= []
      LOCATIONS[script].delete_if{ |loc| loc.cast and Incident.new(script, loc.cast).run }
    end

    def method_missing(meth, *args, &blk)
      puts "#{meth}: #{args.map(&:to_s).join(', ')}"
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ceml-0.4.0 lib/ceml/delegate.rb