Sha256: adf6493915ed641f13bcf83023b5fc3db29ad460b3f54059d33286600a436603
Contents?: true
Size: 497 Bytes
Versions: 2
Compression:
Stored size: 497 Bytes
Contents
# frozen_string_literal: false if Lite::Ruby.configuration.monkey_patches.include?('open_struct') require 'ostruct' class OpenStruct def attributes @table end def replace(args) args.each { |key, val| self[key] = val } end def to_hash(table: true) return attributes unless table { table: attributes } end def to_json(table: true) to_hash(table: table).to_json end alias as_json to_json alias to_h to_hash end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
lite-ruby-1.3.3 | lib/lite/ruby/open_struct.rb |
lite-ruby-1.3.2 | lib/lite/ruby/open_struct.rb |