Sha256: 0fbd94b245c9c5f0c992fe5cf74921d000d67a6a0087bce167a5970ac4444ec2

Contents?: true

Size: 491 Bytes

Versions: 12

Compression:

Stored size: 491 Bytes

Contents

# frozen_string_literal: true

require 'active_support'

class DHS::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

12 entries across 12 versions & 1 rubygems

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