Class: LocalData

Inherits:
Dry::Struct
  • Object
show all
Defined in:
lib/schemas.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_dynamic!(d) ⇒ Object



2875
2876
2877
2878
2879
2880
2881
# File 'lib/schemas.rb', line 2875

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    last_launched:  d["lastLaunched"],
    last_used_date: d["lastUsedDate"],
  )
end

.from_json!(json) ⇒ Object



2883
2884
2885
# File 'lib/schemas.rb', line 2883

def self.from_json!(json)
  from_dynamic!(JSON.parse(json))
end

Instance Method Details

#to_dynamicObject



2887
2888
2889
2890
2891
2892
# File 'lib/schemas.rb', line 2887

def to_dynamic
  {
    "lastLaunched" => last_launched,
    "lastUsedDate" => last_used_date,
  }
end

#to_json(options = nil) ⇒ Object



2894
2895
2896
# File 'lib/schemas.rb', line 2894

def to_json(options = nil)
  JSON.generate(to_dynamic, options)
end