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.



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

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.



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

def from
  @from
end

#toObject

Returns the value of attribute to.



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

def to
  @to
end

Instance Method Details

#extract_name(o) ⇒ Object



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

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

#to_strObject



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

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