Module: InstantiateWithAttrs
- Included in:
- Nextbus::Agency, Nextbus::Direction, Nextbus::Prediction, Nextbus::Report, Nextbus::Route, Nextbus::Stop, Nextbus::Vehicle
- Defined in:
- lib/instantiate_with_attrs.rb
Instance Method Summary collapse
Instance Method Details
#initialize(attrs = {}) ⇒ Object
3 4 5 6 7 8 9 10 |
# File 'lib/instantiate_with_attrs.rb', line 3 def initialize(attrs={}) super() attrs.each do |name, value| setter = "#{name.to_s}=".to_sym self.send(setter, value) if self.respond_to?(setter) end self end |