Module: Ffprober::DynamicInitializer

Includes:
Kernel
Included in:
Chapter, Format, Stream
Defined in:
lib/ffprober/dynamic_initializer.rb

Instance Method Summary collapse

Instance Method Details

#initialize(object_attribute_hash) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/ffprober/dynamic_initializer.rb', line 8

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