Class: Interscript::DSL::Items::Map

Inherits:
Object
  • Object
show all
Defined in:
lib/interscript/dsl/items.rb

Overview

Implementation of ‘map.x.aliasname` and `map.x.stage.stagename`

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Map

Returns a new instance of Map.



67
# File 'lib/interscript/dsl/items.rb', line 67

def initialize name; @name = name; end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missingObject

Implementation of ‘map.x.aliasname`



74
75
76
77
# File 'lib/interscript/dsl/items.rb', line 74

def [] alias_name
  Symbol === alias_name or raise Interscript::MapLogicError, "An alias name must be a Symbol, not #{alias_name.class}"
  Interscript::Node::Item::Alias.new(alias_name, map: @name)
end

Instance Method Details

#[](alias_name) ⇒ Object Also known as: method_missing

Implementation of ‘map.x.aliasname`



70
71
72
73
# File 'lib/interscript/dsl/items.rb', line 70

def [] alias_name
  Symbol === alias_name or raise Interscript::MapLogicError, "An alias name must be a Symbol, not #{alias_name.class}"
  Interscript::Node::Item::Alias.new(alias_name, map: @name)
end

#stageObject

Implementation of ‘map.x.stage.stagename`



77
# File 'lib/interscript/dsl/items.rb', line 77

def stage; Stages.new(@name); end