Sha256: 0dc4f98b7b5f7561b4c909970c23c5ceff60210a99531635503d93a9a77f6be0
Contents?: true
Size: 499 Bytes
Versions: 15
Compression:
Stored size: 499 Bytes
Contents
module TrackingNumber class Info def initialize(info_hash = {}) info_hash.keys.each do |key| self.instance_variable_set("@#{key}", info_hash[key]) self.class_eval { attr_accessor key } end if info_hash.keys.size == 1 @default = info_hash[info_hash.keys.first] end end def method_missing(name, *args) self.instance_variable_get("@#{name}") end def to_s @default || @name end def to_json end end end
Version data entries
15 entries across 15 versions & 1 rubygems