Class: CorrectHorseBatteryStaple::Stats

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/correct_horse_battery_staple/stats.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_hash(hash) ⇒ Object



9
10
11
12
13
# File 'lib/correct_horse_battery_staple/stats.rb', line 9

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

.from_json(json) ⇒ Object



19
20
21
# File 'lib/correct_horse_battery_staple/stats.rb', line 19

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

Instance Method Details

#to_hashObject



5
6
7
# File 'lib/correct_horse_battery_staple/stats.rb', line 5

def to_hash
  marshal_dump
end

#to_jsonObject



15
16
17
# File 'lib/correct_horse_battery_staple/stats.rb', line 15

def to_json
  to_hash.to_json
end