Module: HandBrake::ConstructWithProperties

Included in:
Chapter, Title
Defined in:
lib/handbrake/disc.rb

Overview

Mix-in that provides a class with a constructor that sets any publicly writable properties from values in a hash.

Instance Method Summary collapse

Instance Method Details

#initialize(properties = {}) ⇒ Object



129
130
131
132
133
134
135
136
137
138
# File 'lib/handbrake/disc.rb', line 129

def initialize(properties={})
  properties.each do |prop, value|
    setter = :"#{prop}="
    if self.respond_to?(setter)
      self.send(setter, value)
    else
      fail("No property #{prop.inspect} in #{self.class}")
    end
  end
end