Sha256: 3f0ec53ab163597bbac076f44335c73097a4d81b052e0b0bcd594d6b6dece977

Contents?: true

Size: 402 Bytes

Versions: 1

Compression:

Stored size: 402 Bytes

Contents

module FormStalker
  module Data
    class Base < OpenStruct
      def self.tap_into(response)
        return response unless response.ok?

        response.data =
          if response.data.is_a?(Array)
            response.data.map { |subset| new(subset) }
          else
            new(response.data)
          end

        response
      end

      alias attributes marshal_dump
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
form_stalker-1.0.0 lib/form_stalker/data/base.rb