Sha256: f0814568c99b033830ea42eb8e146fd8c98d91a785de6340d6ff835f29fe85ef
Contents?: true
Size: 859 Bytes
Versions: 6
Compression:
Stored size: 859 Bytes
Contents
# frozen_string_literal: true module RubyRabbitmqJanus module Tools # Class for converting elemnts given by apps to this gem an type conform # to request sending class Type # Initalize an object for cast a type to data given by app def initialize(request) @request = request @data = nil end # Return an data with a type corresponding to string in request def convert(key, option) @data = option[key] case @request[key] when '<string>' then convert_to_type_string when '<number>' then convert_to_type_number end end private # Convert a data to String type def convert_to_type_string @data.to_s end # Convert a data to Integer type def convert_to_type_number @data.to_i end end end end
Version data entries
6 entries across 6 versions & 1 rubygems