Class: PBKDF2

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



675
676
677
678
679
680
# File 'lib/schemas.rb', line 675

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

.from_json!(json) ⇒ Object



682
683
684
# File 'lib/schemas.rb', line 682

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

Instance Method Details

#to_dynamicObject



686
687
688
689
690
# File 'lib/schemas.rb', line 686

def to_dynamic
  {
    "iterations" => iterations,
  }
end

#to_json(options = nil) ⇒ Object



692
693
694
# File 'lib/schemas.rb', line 692

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