Sha256: 5e915c7c75900a578c42154a542686974d1047d6e7cd3daa15243b739c7d3cbe

Contents?: true

Size: 343 Bytes

Versions: 22

Compression:

Stored size: 343 Bytes

Contents

class TypedStruct < Struct
  def self.new *members_types
    members, mtypes = members_types.transpose
    klass           = Struct.new *members.map(&:to_sym)
    klass.class_eval do
      cattr_accessor :mtypes, :members_types
      self.mtypes        = mtypes
      self.members_types = Hash.zip(members, mtypes)
    end
    klass
  end
end

Version data entries

22 entries across 22 versions & 2 rubygems

Version Path
mrflip-wukong-0.1.0 lib/wukong/typed_struct.rb
wukong-3.0.0.pre old/wukong/typed_struct.rb
wukong-2.0.2 lib/wukong/typed_struct.rb
wukong-2.0.1 lib/wukong/typed_struct.rb
wukong-2.0.0 lib/wukong/typed_struct.rb
wukong-1.5.4 lib/wukong/typed_struct.rb
wukong-1.5.3 lib/wukong/typed_struct.rb
wukong-1.5.2 lib/wukong/typed_struct.rb
wukong-1.5.1 lib/wukong/typed_struct.rb
wukong-1.5.0 lib/wukong/typed_struct.rb
wukong-1.4.12 lib/wukong/typed_struct.rb
wukong-1.4.11 lib/wukong/typed_struct.rb
wukong-1.4.10 lib/wukong/typed_struct.rb
wukong-1.4.9 lib/wukong/typed_struct.rb
wukong-1.4.7 lib/wukong/typed_struct.rb
wukong-1.4.6 lib/wukong/typed_struct.rb
wukong-1.4.5 lib/wukong/typed_struct.rb
wukong-1.4.2 lib/wukong/typed_struct.rb
wukong-1.4.1 lib/wukong/typed_struct.rb
wukong-1.4.0 lib/wukong/typed_struct.rb