Method: Interscript::DSL::Metadata#initialize

Defined in:
lib/interscript/dsl/metadata.rb

#initialize(yaml: false, map_name: "", library: true, &block) ⇒ Metadata

Returns a new instance of Metadata.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/interscript/dsl/metadata.rb', line 6

def initialize(yaml: false, map_name: "", library: true, &block)
  raise Interscript::MapLogicError, "Can't evaluate metadata from Ruby context" unless yaml
  @map_name = map_name
  @node = Interscript::Node::MetaData.new
  self.instance_exec(&block)
  @node[:nonstandard] = {}

  NECESSARY_KEYS.each do |i|
    unless @node.data.key? i
      warn "[#{@map_name}] Necessary key #{i} wasn't defined. Defaulting to an empty string"
      @node[i] = ""
    end
  end unless library
end