Sha256: 8bcd10f9588499db5a6c000610d1334cc2af80fe8a9f5950ab55b20997ee390b

Contents?: true

Size: 541 Bytes

Versions: 15

Compression:

Stored size: 541 Bytes

Contents

module RockRMS
  module Response
    class Base
      attr_reader :data

      def self.format(data)
        new(data).format
      end

      def initialize(data)
        @data = data
      end

      def format
        if data.is_a?(Array)
          data.map { |item| format_single(item) }
        else
          format_single(data)
        end
      end

      def to_h(dict, data)
        return {} if data.nil?

        dict.each_with_object({}) do |(l, r), object|
          object[l] = data[r]
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
rock_rms-7.0.2 lib/rock_rms/response/base.rb
rock_rms-7.0.1 lib/rock_rms/response/base.rb
rock_rms-7.0.0 lib/rock_rms/response/base.rb
rock_rms-6.2.0 lib/rock_rms/response/base.rb
rock_rms-6.1.0 lib/rock_rms/response/base.rb
rock_rms-6.0.8 lib/rock_rms/response/base.rb
rock_rms-6.0.7 lib/rock_rms/response/base.rb
rock_rms-6.0.6 lib/rock_rms/response/base.rb
rock_rms-6.0.5 lib/rock_rms/response/base.rb
rock_rms-6.0.4 lib/rock_rms/response/base.rb
rock_rms-6.0.3 lib/rock_rms/response/base.rb
rock_rms-6.0.1 lib/rock_rms/response/base.rb
rock_rms-6.0.0 lib/rock_rms/response/base.rb
rock_rms-5.18.0 lib/rock_rms/response/base.rb
rock_rms-5.17.0 lib/rock_rms/response/base.rb