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



2626
2627
2628
2629
2630
2631
2632
# File 'lib/schemas.rb', line 2626

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

.from_json!(json) ⇒ Object



2634
2635
2636
# File 'lib/schemas.rb', line 2634

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

Instance Method Details

#to_dynamicObject



2638
2639
2640
2641
2642
2643
# File 'lib/schemas.rb', line 2638

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

#to_json(options = nil) ⇒ Object



2645
2646
2647
# File 'lib/schemas.rb', line 2645

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