Sha256: 773d5108b0c9d066c3d2e25695c6272d93431508a1a7993f9e7b49f4e74792da
Contents?: true
Size: 457 Bytes
Versions: 1
Compression:
Stored size: 457 Bytes
Contents
class Value def self.new(*fields) return Class.new do attr_reader *fields define_method(:initialize) do |*input_fields| raise ArgumentError.new("wrong number of arguments, #{input_fields.size} for #{fields.size}") if fields.size != input_fields.size fields.each_with_index do |field, index| instance_variable_set('@' + field.to_s, input_fields[index]) end self.freeze end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
values-1.0.1 | lib/values.rb |