Sha256: 03645eeca91f6bc7ff09ec347c5e83796dc864a23b60e05487d42aa6a89831ba

Contents?: true

Size: 434 Bytes

Versions: 76

Compression:

Stored size: 434 Bytes

Contents

# frozen_string_literal: true

require 'active_support'

class LHS::Data

  module Becomes
    extend ActiveSupport::Concern

    def becomes(klass, options = {})
      return self if self.class == klass && !is_a?(LHS::Data)
      data = LHS::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

76 entries across 76 versions & 1 rubygems

Version Path
lhs-26.2.0 lib/lhs/concerns/data/becomes.rb
lhs-26.1.0 lib/lhs/concerns/data/becomes.rb
lhs-26.0.1 lib/lhs/concerns/data/becomes.rb
lhs-26.0.0 lib/lhs/concerns/data/becomes.rb
lhs-25.2.0 lib/lhs/concerns/data/becomes.rb
lhs-25.1.0 lib/lhs/concerns/data/becomes.rb
lhs-25.0.4 lib/lhs/concerns/data/becomes.rb
lhs-25.0.3 lib/lhs/concerns/data/becomes.rb
lhs-25.0.2 lib/lhs/concerns/data/becomes.rb
lhs-25.0.1 lib/lhs/concerns/data/becomes.rb
lhs-25.0.0 lib/lhs/concerns/data/becomes.rb
lhs-24.1.2 lib/lhs/concerns/data/becomes.rb
lhs-24.1.1 lib/lhs/concerns/data/becomes.rb
lhs-24.1.0 lib/lhs/concerns/data/becomes.rb
lhs-24.1.0.pre.2 lib/lhs/concerns/data/becomes.rb
lhs-24.1.0.pre.1 lib/lhs/concerns/data/becomes.rb
lhs-24.0.0 lib/lhs/concerns/data/becomes.rb
lhs-23.0.2 lib/lhs/concerns/data/becomes.rb
lhs-23.0.1 lib/lhs/concerns/data/becomes.rb
lhs-23.0.0 lib/lhs/concerns/data/becomes.rb