Sha256: 5d24bae4b6ee84d63e0db64ea1f5600f43333412b69e63d3f2022359ccf43376
Contents?: true
Size: 502 Bytes
Versions: 3
Compression:
Stored size: 502 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| send("#{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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
lite-ruby-1.3.1 | lib/lite/ruby/open_struct.rb |
lite-ruby-1.3.0 | lib/lite/ruby/open_struct.rb |
lite-ruby-1.2.0 | lib/lite/ruby/open_struct.rb |