Sha256: 89e6d719fdafc22aa2a2c493096d8c900307ebedda1855bc3b5967d1743136c2

Contents?: true

Size: 1.31 KB

Versions: 11

Compression:

Stored size: 1.31 KB

Contents

#
# PerfectSched
#
# Copyright (C) 2012 FURUHASHI Sadayuki
#
#    Licensed under the Apache License, Version 2.0 (the "License");
#    you may not use this file except in compliance with the License.
#    You may obtain a copy of the License at
#
#        http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS,
#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#    See the License for the specific language governing permissions and
#    limitations under the License.
#

module PerfectSched

  class ScheduleCollection
    include Model

    def initialize(client)
      super(client)
    end

    # => Schedule
    def [](key)
      Schedule.new(@client, key)
    end

    def list(options={}, &block)
      @client.list(options, &block)
    end

    def poll(options={})
      options = options.merge({:max_acquire=>1})
      if acquired = poll_multi(options)
        return acquired[0]
      end
      return nil
    end

    def poll_multi(options={})
      @client.acquire(options)
    end

    # :data => Hash
    # :cron
    # :timezone
    def add(key, type, options={})
      @client.add(key, type, options)
    end

    def close
      client.close
    end
  end

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
perfectsched-0.8.12 lib/perfectsched/schedule_collection.rb
perfectsched-0.8.11 lib/perfectsched/schedule_collection.rb
perfectsched-0.8.10 lib/perfectsched/schedule_collection.rb
perfectsched-0.8.9 lib/perfectsched/schedule_collection.rb
perfectsched-0.8.8 lib/perfectsched/schedule_collection.rb
perfectsched-0.8.7 lib/perfectsched/schedule_collection.rb
perfectsched-0.8.4 lib/perfectsched/schedule_collection.rb
perfectsched-0.8.3 lib/perfectsched/schedule_collection.rb
perfectsched-0.8.2 lib/perfectsched/schedule_collection.rb
perfectsched-0.8.1 lib/perfectsched/schedule_collection.rb
perfectsched-0.8.0 lib/perfectsched/schedule_collection.rb