Sha256: 702f2d7aae72d3ade5b192f2240544e3f9bf8a450b9fd78ccb60840575ff4c6d

Contents?: true

Size: 324 Bytes

Versions: 6

Compression:

Stored size: 324 Bytes

Contents

require 'ostruct'
require 'json'

class CorrectHorseBatteryStaple::Stats < OpenStruct
  def to_hash
    marshal_dump
  end

  def self.from_hash(hash)
    new.tap do |newobj|
      marshal_load(hash)
    end
  end

  def to_json
    to_hash.to_json
  end

  def self.from_json(json)
    from_hash JSON.parse(json)
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
correct-horse-battery-staple-0.6.6 lib/correct_horse_battery_staple/stats.rb
correct-horse-battery-staple-0.6.5 lib/correct_horse_battery_staple/stats.rb
correct-horse-battery-staple-0.6.4 lib/correct_horse_battery_staple/stats.rb
correct-horse-battery-staple-0.6.3 lib/correct_horse_battery_staple/stats.rb
correct-horse-battery-staple-0.6.2 lib/correct_horse_battery_staple/stats.rb
correct-horse-battery-staple-0.6.1 lib/correct_horse_battery_staple/stats.rb