Sha256: 7ae2536a96b42ad5d375435a8c04f4de5106523c112482442eb4206191f5007c

Contents?: true

Size: 269 Bytes

Versions: 2

Compression:

Stored size: 269 Bytes

Contents

class FlexStruct
  # FlexStruct's initializer adds two alternate ways to initialize a Struct
  module Initializer
    def initialize(*args, **kwargs)
      super(*args)
      kwargs.each { |key, val| self[key] = val }
      yield self if block_given?
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
flex_struct-0.1.2 lib/flex_struct/initializer.rb
flex_struct-0.1.1 lib/flex_struct/initializer.rb