Sha256: 4d77bd93c3c140c456d13513d69d7ee627a93e7cc890ac7edd043eb4174ea289

Contents?: true

Size: 1.18 KB

Versions: 2

Compression:

Stored size: 1.18 KB

Contents

# frozen_string_literal: true

require 'set'

module Yuuki
  module Runner
    # add method
    def add(*methods)
      @yuuki_methods ||= {}
      methods.each do |method|
        @yuuki_methods[method] ||= {}
        @yuuki_methods[method][:enabled] = true
      end
    end

    # delete method
    def delete(*methods)
      @yuuki_methods ||= {}
      methods.each do |method|
        @yuuki_methods[method] ||= {}
        @yuuki_methods[method][:enabled] = false
      end
    end

    # add tags to the method
    def tag(method, *tags)
      @yuuki_methods ||= {}
      @yuuki_methods[method] ||= {}
      @yuuki_methods[method][:tags] ||= Set.new
      @yuuki_methods[method][:tags].merge(tags)
    end

    # enable threading to the method
    def thread(*methods, enabled: true)
      @yuuki_methods ||= {}
      methods.each do |method|
        @yuuki_methods[method] ||= {}
        @yuuki_methods[method][:thread] = enabled
      end
    end

    # set priority to the method
    def priority(*methods, priority)
      @yuuki_methods ||= {}
      methods.each do |method|
        @yuuki_methods[method] ||= {}
        @yuuki_methods[method][:priority] = priority
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
yuuki-0.1.2 lib/yuuki/runner.rb
yuuki-0.1.1 lib/yuuki/runner.rb