Sha256: c0cf1993a8724923816899fb327894ecacdfbfc5c788bb9885127c74b9dedc37

Contents?: true

Size: 702 Bytes

Versions: 4

Compression:

Stored size: 702 Bytes

Contents

module FFI
  module HiredisVip
    class Info
      attr_reader :original_info, :info_hash

      def initialize(info_string)
        @info_hash = {}
        @original_info = info_string
        process_original_info
      end
      
      def [](key)
        @info_hash[key]
      end

      def method_missing(method_name, *args, &block)
        @info_hash[method_name] || super
      end

      private

      def process_original_info
        original_info.each_line do |info_line|
          next unless info_line.include?(":")

          parts = info_line.split(":")
          @info_hash[parts.shift.strip] = parts.join(":").strip
        end
      end
    end # Info
  end # HiredisVip
end # FFI

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ffi-hiredis_vip-0.1.0.pre4 lib/ffi/hiredis_vip/info.rb
ffi-hiredis_vip-0.1.0.pre3 lib/ffi/hiredis_vip/info.rb
ffi-hiredis_vip-0.1.0.pre2 lib/ffi/hiredis_vip/info.rb
ffi-hiredis_vip-0.1.0.pre1 lib/ffi/hiredis_vip/info.rb