Module: Textus::Envelope
- Defined in:
- lib/textus/envelope.rb
Class Method Summary collapse
-
.build(key:, mentry:, path:, meta:, body:, etag:, content: nil) ⇒ Object
rubocop:disable Metrics/ParameterLists.
- .extract_uid(meta) ⇒ Object
Class Method Details
.build(key:, mentry:, path:, meta:, body:, etag:, content: nil) ⇒ Object
rubocop:disable Metrics/ParameterLists
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/textus/envelope.rb', line 6 def self.build(key:, mentry:, path:, meta:, body:, etag:, content: nil) # rubocop:enable Metrics/ParameterLists env = { "protocol" => PROTOCOL, "key" => key, "zone" => mentry.zone, "owner" => mentry.owner, "path" => path, "format" => mentry.format, "_meta" => , "body" => body, "etag" => etag, "schema_ref" => mentry.schema, "uid" => extract_uid(), } env["content"] = content unless content.nil? env end |
.extract_uid(meta) ⇒ Object
25 26 27 28 |
# File 'lib/textus/envelope.rb', line 25 def self.extract_uid() v = .is_a?(Hash) ? ["uid"] : nil v.is_a?(String) ? v : nil end |