Sha256: e5ab4734e97817b7cdfa1720e0320f23c44a1227d638004692cb30b718712edd

Contents?: true

Size: 460 Bytes

Versions: 9

Compression:

Stored size: 460 Bytes

Contents

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

9 entries across 9 versions & 1 rubygems

Version Path
lhs-16.1.5 lib/lhs/concerns/record/custom_setters.rb
lhs-16.1.4 lib/lhs/concerns/record/custom_setters.rb
lhs-16.1.3 lib/lhs/concerns/record/custom_setters.rb
lhs-16.1.2 lib/lhs/concerns/record/custom_setters.rb
lhs-16.1.1 lib/lhs/concerns/record/custom_setters.rb
lhs-16.1.0 lib/lhs/concerns/record/custom_setters.rb
lhs-16.0.1 lib/lhs/concerns/record/custom_setters.rb
lhs-16.0.0 lib/lhs/concerns/record/custom_setters.rb
lhs-15.7.0 lib/lhs/concerns/record/custom_setters.rb