Class: Ortfodb::DatabaseMeta

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_dynamic!(d) ⇒ Object



318
319
320
321
322
323
# File 'lib/ortfodb/database.rb', line 318

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    partial: d.fetch("Partial"),
  )
end

.from_json!(json) ⇒ Object



325
326
327
# File 'lib/ortfodb/database.rb', line 325

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

Instance Method Details

#to_dynamicObject



329
330
331
332
333
# File 'lib/ortfodb/database.rb', line 329

def to_dynamic
  {
    "Partial" => partial,
  }
end

#to_json(options = nil) ⇒ Object



335
336
337
# File 'lib/ortfodb/database.rb', line 335

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