Sha256: f060e63f0620a15670c49efdc5e57627fe73d2c1e186e675baf6717c627ee469
Contents?: true
Size: 1017 Bytes
Versions: 10
Compression:
Stored size: 1017 Bytes
Contents
module Exlibris module Aleph # # Write passed in arguments to instance attributes # module WriteAttributes def initialize *args # Just call super w/o any args for now. Eventually, we'll want to check the arity and adjust. # self.class.superclass.instance_method(:initialize).arity.eql? self.class.instance_method(:initialize).arity super write_attributes args.last unless args.last.nil? end def write_attributes attributes attributes.each do |attribute, value| write_attribute attribute, value end end def attributize symbol symbol.id2name.sub(/=$/, "").to_sym end protected :attributize def write_attribute attribute, value attribute_writer = writify attribute send attribute_writer, value if respond_to? attribute_writer end private :write_attribute def writify key "#{key}=".to_sym end private :writify end end end
Version data entries
10 entries across 10 versions & 1 rubygems