Sha256: 31bad656ffdb1d9b63c4d85b76c9491166b904a1442b15ed210948a6706a6932

Contents?: true

Size: 1.23 KB

Versions: 18

Compression:

Stored size: 1.23 KB

Contents

# This file is part of CPEE.
# 
# CPEE is free software: you can redistribute it and/or modify it under the terms
# of the GNU General Public License as published by the Free Software Foundation,
# either version 3 of the License, or (at your option) any later version.
# 
# CPEE is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.  See the GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License along with
# CPEE (file COPYING in the main directory).  If not, see
# <http://www.gnu.org/licenses/>.

module CPEE

  class Callback
    def initialize(info,handler,method,event,key,protocol,*data)
      @info = info
      @event = event
      @key = key
      @data = data
      @handler = handler
      @protocol = protocol
      @method = method.class == Symbol ? method : :callback
    end

    attr_reader :info, :protocol, :method

    def delete_if!(event,key)
      @handler.send @method, :DELETE, *@data if @key == key && @event == event
      nil
    end

    def callback(result=nil,options=nil)
      @handler.send @method, result, options, *@data
    end
  end

end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
cpee-1.3.199 lib/cpee/callback.rb
cpee-1.3.198 lib/cpee/callback.rb
cpee-1.3.197 lib/cpee/callback.rb
cpee-1.3.196 lib/cpee/callback.rb
cpee-1.3.195 lib/cpee/callback.rb
cpee-1.3.194 lib/cpee/callback.rb
cpee-1.3.193 lib/cpee/callback.rb
cpee-1.3.192 lib/cpee/callback.rb
cpee-1.3.191 lib/cpee/callback.rb
cpee-1.3.190 lib/cpee/callback.rb
cpee-1.3.189 lib/cpee/callback.rb
cpee-1.3.188 lib/cpee/callback.rb
cpee-1.3.187 lib/cpee/callback.rb
cpee-1.3.185 lib/cpee/callback.rb
cpee-1.3.184 lib/cpee/callback.rb
cpee-1.3.183 lib/cpee/callback.rb
cpee-1.3.181 lib/cpee/callback.rb
cpee-1.3.180 lib/cpee/callback.rb