Class: Mork::Raw::Dictionary

Inherits:
Object
  • Object
show all
Defined in:
lib/mork/raw/dictionary.rb

Overview

A key-value mapping with a namespace (“scope”)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(values:) ⇒ Dictionary

Returns a new instance of Dictionary.



13
14
15
# File 'lib/mork/raw/dictionary.rb', line 13

def initialize(values:)
  @values = values
end

Instance Attribute Details

#valuesObject (readonly)

Returns the value of attribute values.



11
12
13
# File 'lib/mork/raw/dictionary.rb', line 11

def values
  @values
end

Instance Method Details

#scopeObject

a - “Atom” - the data c - “Column” - the column name



23
24
25
# File 'lib/mork/raw/dictionary.rb', line 23

def scope
  meta&.scope || "a"
end

#to_hObject



17
18
19
# File 'lib/mork/raw/dictionary.rb', line 17

def to_h
  aliases.each.with_object({}) { |a, acc| acc[a.key] = a.value }
end