Sha256: d688b33fed579ce837da482600a468f405bf4dfdfdae803325f5780ef8688ede

Contents?: true

Size: 551 Bytes

Versions: 2

Compression:

Stored size: 551 Bytes

Contents

require "concurrent-ruby"
require 'set'

module Shatter
  module Service
    class ServiceDefinition
      include Concurrent::Async
      class << self
        attr_reader :function_collection
      end
      def self.register_function(identifier, function)
        Shatter.logger.info "Registering function - #{identifier} for #{self}"
        @function_collection ||= {}
        @function_collection[identifier.to_s] = function
        define_method identifier do |params|
          function.new(params).call
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
shatter-rb-0.0.2 lib/shatter/service/service_definition.rb
shatter-rb-0.0.1 lib/shatter/service/service_definition.rb