Class: Vizier::Link

Inherits:
Base show all
Includes:
Support
Defined in:
lib/support/vizier.rb

Constant Summary

Constants included from Support

Support::LEGAL_CHARS

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Support

#attributes, #attributes=, included, #legal?, #quote, #sanitize

Methods inherited from Base

#[], #[]=

Constructor Details

#initialize(from, to, attrs = {}) ⇒ Link

Returns a new instance of Link.



102
103
104
105
106
# File 'lib/support/vizier.rb', line 102

def initialize( from, to, attrs={} )
  self.attributes = attrs
  @from = extract_name( from )
  @to = extract_name( to )
end

Instance Attribute Details

#fromObject

Returns the value of attribute from.



99
100
101
# File 'lib/support/vizier.rb', line 99

def from
  @from
end

#toObject

Returns the value of attribute to.



100
101
102
# File 'lib/support/vizier.rb', line 100

def to
  @to
end

Instance Method Details

#extract_name(o) ⇒ Object



108
109
110
# File 'lib/support/vizier.rb', line 108

def extract_name( o )
  o.is_a?(String) ? o : o.name
end

#to_strObject



112
113
114
# File 'lib/support/vizier.rb', line 112

def to_str
  "#{quote from} -> #{quote to} #{attributes};"
end