Sha256: d404c538d418356b15d5ca8386812e6e203d6700b0d73f631bb50457acc3dce5

Contents?: true

Size: 429 Bytes

Versions: 1

Compression:

Stored size: 429 Bytes

Contents

# typed: true
# frozen_string_literal: true

module Ffprober
  module DynamicInitializer
    include Kernel

    def initialize(object_attribute_hash)
      object_attribute_hash.each do |key, value|
        instance_variable_set("@#{key}", value)

        next if self.class.method_defined?(key)

        self.class.send(:define_method, key) do
          instance_variable_get("@#{key}")
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ffprober-1.0 lib/ffprober/dynamic_initializer.rb