Sha256: a733ccf55ce628e3c8d51f30873383899f5b9e2e71d847502a2d7cbf68f6a58e

Contents?: true

Size: 439 Bytes

Versions: 12

Compression:

Stored size: 439 Bytes

Contents

# frozen_string_literal: true

require 'active_support'

class DHS::Data

  module Becomes
    extend ActiveSupport::Concern

    def becomes(klass, options = {})
      return self if self.instance_of?(klass) && !is_a?(DHS::Data)
      data = DHS::Data.new(_raw, _parent, klass)
      data.errors = options[:errors] if options[:errors]
      data.warnings = options[:warnings] if options[:warnings]
      klass.new(data)
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
dhs-1.6.0 lib/dhs/concerns/data/becomes.rb
dhs-1.5.0 lib/dhs/concerns/data/becomes.rb
dhs-1.4.2 lib/dhs/concerns/data/becomes.rb
dhs-1.4.1 lib/dhs/concerns/data/becomes.rb
dhs-1.4.0 lib/dhs/concerns/data/becomes.rb
dhs-1.3.0 lib/dhs/concerns/data/becomes.rb
dhs-1.2.0 lib/dhs/concerns/data/becomes.rb
dhs-1.1.0 lib/dhs/concerns/data/becomes.rb
dhs-1.0.3 lib/dhs/concerns/data/becomes.rb
dhs-1.0.2 lib/dhs/concerns/data/becomes.rb
dhs-1.0.1 lib/dhs/concerns/data/becomes.rb
dhs-1.0.0 lib/dhs/concerns/data/becomes.rb