Sha256: 3c824c8d46a4c01e16e9be354fd3b9ba0c2b8535341bfabde78b7a7144449d2e

Contents?: true

Size: 453 Bytes

Versions: 1

Compression:

Stored size: 453 Bytes

Contents

module Superlime
  class Command
    def self.call(args)
      catch(:broadcast) do
        new(args).call
      end
    end

    def initialize(*args)
      raise NotImplementedError, "must implement #initialize on subclass"
    end

    def call
      raise NotImplementedError, "must implement #call on subclass"
    end

    private

    def broadcast(event, payload)
      throw(:broadcast, event => payload)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
superlime-0.1.0 lib/superlime/command.rb