Sha256: a091bb9b196022c7e28609931ae69f9c4bdcad788244683fb8898e645071ed4d

Contents?: true

Size: 878 Bytes

Versions: 1

Compression:

Stored size: 878 Bytes

Contents

#!/usr/bin/env ruby

require_relative '../lib/daemon_runner'

class MyService
  class Tasks
    class Foo
      def run!
        puts 'foo'
        'foo'
      end
    end
  end
end

class MyService
  class Tasks
    class Bar
      def run!(name)
        puts name
        name
      end
    end
  end
end

class MyService
  class Tasks
    class Baz
      class << self
        def run!(args)
          name = args[0]
          reason = args[1]
          puts name
          puts reason
          name
        end
      end
    end
  end
end

class MyService
  class Client < DaemonRunner::Client
    def tasks
      [
        [::MyService::Tasks::Foo.new, 'run!'],
        [::MyService::Tasks::Bar.new, 'run!', 'bar'],
        [::MyService::Tasks::Baz, 'run!', 'baz', 'because']
      ]
    end
  end
end

options = {}
service = MyService::Client.new(options)
service.start!

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
daemon_runner-0.2.2 examples/example1.rb