Sha256: e64107ee6388e3caf1883cfaa255fb2186773af0440f204c2b78b180dd884d43
Contents?: true
Size: 592 Bytes
Versions: 6
Compression:
Stored size: 592 Bytes
Contents
# Copyright (c) 2006 Michael Fellinger m.fellinger@gmail.com # All files in this distribution are subject to the terms of the Ruby license. # Extensions for Struct class Struct # Action = Struct.new('Action', :template, :method, :params) # # a = Action.fill(:template => nil, :method => :meth, :params => [1]) # # => #<struct Struct::Action template=nil, method=:meth, params=[1]> def self.fill(hash = {}) instance = new hash.each do |key, value| next unless members.include?(key.to_s) instance.send("#{key}=", value) end instance end end
Version data entries
6 entries across 6 versions & 1 rubygems