Class: Phut::Syntax::LinkDirective

Inherits:
Object
  • Object
show all
Defined in:
lib/phut/syntax.rb

Overview

The ‘link name_a, name_b’ directive.

Defined Under Namespace

Classes: LinkId

Constant Summary collapse

LinkIdSingleton =
LinkId.new

Instance Method Summary collapse

Constructor Details

#initialize(name_a, name_b, link_id) ⇒ LinkDirective

Returns a new instance of LinkDirective.



88
89
90
91
92
93
94
95
# File 'lib/phut/syntax.rb', line 88

def initialize(name_a, name_b, link_id)
  @attributes = {}
  @attributes[:name_a] = name_a
  @attributes[:name_b] = name_b
  link_id = LinkIdSingleton.generate
  @attributes[:device_a] = "link#{link_id}-0"
  @attributes[:device_b] = "link#{link_id}-1"
end

Instance Method Details

#[](key) ⇒ Object



97
98
99
# File 'lib/phut/syntax.rb', line 97

def [](key)
  @attributes[key]
end