Sha256: 21b8ef89ad3f9c16dd6c3ea8d879e16e3bfd79b370ac7ca0302cdba24af1d7b2

Contents?: true

Size: 223 Bytes

Versions: 4

Compression:

Stored size: 223 Bytes

Contents

require 'json'

module Kosher
  class Struct < ::Struct
    def to_map
      map = Hash.new
      self.members.each { |m| map[m] = self[m] }
      map
    end

    def to_json(*a)
      to_map.to_json(*a)
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
fassbinder-0.0.1 lib/fassbinder/struct.rb
kosher-0.1.12 lib/kosher/struct.rb
kosher-0.1.9 lib/kosher/struct.rb
kosher-0.1.8 lib/kosher/struct.rb