Sha256: 66444d5299136eb991d92845e17dfcfa244405695d510c730fed69d03d9c580a

Contents?: true

Size: 394 Bytes

Versions: 3

Compression:

Stored size: 394 Bytes

Contents

# frozen_string_literal: true

module Ffprober
  module DynamicInitializer
    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

3 entries across 3 versions & 1 rubygems

Version Path
ffprober-0.5.5 lib/ffprober/dynamic_initializer.rb
ffprober-0.5.3 lib/ffprober/dynamic_initializer.rb
ffprober-0.5.2 lib/ffprober/dynamic_initializer.rb