Sha256: a6291992f7e4e3204a2b4f99e5ff61da409cfd0698dd072b9e0a2534bea2d0be

Contents?: true

Size: 742 Bytes

Versions: 1

Compression:

Stored size: 742 Bytes

Contents

require "hara/version"

module Hara
  class << self
    #decode message, return action and args
    def decode_msg msg
      msg = JSON.parse(msg)
      msg.values_at 'action', 'args'
    end

    def encode_msg action, *args
      {action: action, args: args}.to_json
    end

    def filter_class
      @filter_class || DefaultFilter
    end

    def filter_class= klass
      @filter_class = klass
    end

    def filter_pool_size= size
      @filter_pool_size = size
    end

    def filter_pool_size
      @filter_pool_size || 10
    end

    def filter_pool
      @filter_pool ||= filter_class.pool(size: filter_pool_size)
    end
  end
end

require 'hara/app'
require 'hara/filter'
require 'hara/default_filter'
require 'hara/server'

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hara-0.3.0 lib/hara.rb