Sha256: 34b7ede1b9fa6f6f1fca05af67acd756a1dbe6eaee829a74fb873b40bc59c4d2

Contents?: true

Size: 491 Bytes

Versions: 76

Compression:

Stored size: 491 Bytes

Contents

# frozen_string_literal: true

require 'active_support'

class LHS::Record

  module CustomSetters
    extend ActiveSupport::Concern

    private

    def apply_custom_setters!
      return if !_data.item? || !_data._raw.respond_to?(:keys)
      raw = _data._raw
      custom_setters = raw.keys.find_all { |key| public_methods.include?("#{key}=".to_sym) }
      custom_setters.each do |setter|
        value = raw.delete(setter)
        send("#{setter}=", value)
      end
    end
  end
end

Version data entries

76 entries across 76 versions & 1 rubygems

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