Module: EDNT

Defined in:
lib/edn_turbo/version.rb,
lib/edn_turbo/edn_parser.rb,
ext/edn_turbo/main.cc

Overview

methods specific to edn_turbo

Constant Summary collapse

VERSION =
'0.7.1'
RELEASE_DATE =
'2021-02-07'

Class Method Summary collapse

Class Method Details

.extend_for_meta(value, ext_meta) ⇒ Object

Bind the given meta to the value.



29
30
31
32
33
34
35
36
37
38
# File 'lib/edn_turbo/edn_parser.rb', line 29

def self.extend_for_meta(value, ext_meta)
   = EDNT.merge_meta(ext_meta)

  unless .empty?
    value.extend EDN::Metadata
    value. = 
  end

  value
end

.merge_meta(meta) ⇒ Object



40
41
42
43
44
45
46
47
48
# File 'lib/edn_turbo/edn_parser.rb', line 40

def self.merge_meta(meta)
  meta.reduce({}) do |acc, m|
    case m
    when Symbol then acc.merge(m => true)
    when EDN::Type::Symbol then acc.merge(tag: m)
    else acc.merge(m)
    end
  end
end