Sha256: abab2d0bc0d4eba2f9e6b3949560a07eeee488d7750e2a81ff2bcfd59ff22d5b

Contents?: true

Size: 254 Bytes

Versions: 4

Compression:

Stored size: 254 Bytes

Contents

module FromHash
  def from_hash(ops)
    ops.each do |k,v|
      send("#{k}=",v)
    end
    self
  end
  def initialize(ops={})
    from_hash(ops)
  end
end

class Class
  def self.from_hash(ops={})
    res = new
    res.from_hash(ops)
    res
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mharris_ext-1.7.1 lib/mharris_ext/from_hash.rb
mharris_ext-1.7.0 lib/mharris_ext/from_hash.rb
mharris_ext-1.6.0 lib/mharris_ext/from_hash.rb
mharris_ext-1.5.0 lib/mharris_ext/from_hash.rb