Sha256: 5cddcfaa329d07cfd6f41a25c7f044ed6d4ad2b1b451cefb91c750cb102cfd2c

Contents?: true

Size: 227 Bytes

Versions: 2

Compression:

Stored size: 227 Bytes

Contents

module InstantiateWithAttrs
  
  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

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nextbus-0.0.1 lib/instantiate_with_attrs.rb
nextbus-0.0.0 lib/instantiate_with_attrs.rb