Class: Ortfodb::Technology
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- Ortfodb::Technology
- Defined in:
- lib/ortfodb/technologies.rb
Overview
Technology represents a “technology” (in the very broad sense) that was used to create a work.
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.from_dynamic!(d) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/ortfodb/technologies.rb', line 56 def self.from_dynamic!(d) d = Types::Hash[d] new( aliases: d["aliases"], autodetect: d["autodetect"], by: d["by"], description: d["description"], files: d["files"], learn_more_at: d["learn more at"], technology_name: d.fetch("name"), slug: d.fetch("slug"), ) end |
.from_json!(json) ⇒ Object
70 71 72 |
# File 'lib/ortfodb/technologies.rb', line 70 def self.from_json!(json) from_dynamic!(JSON.parse(json)) end |
Instance Method Details
#to_dynamic ⇒ Object
74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/ortfodb/technologies.rb', line 74 def to_dynamic { "aliases" => aliases, "autodetect" => autodetect, "by" => by, "description" => description, "files" => files, "learn more at" => learn_more_at, "name" => technology_name, "slug" => slug, } end |
#to_json(options = nil) ⇒ Object
87 88 89 |
# File 'lib/ortfodb/technologies.rb', line 87 def to_json( = nil) JSON.generate(to_dynamic, ) end |