Class: Vizier::Link

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

Constant Summary

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

- (Link) initialize(from, to, attrs = {})

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

- (Object) from

Returns the value of attribute from



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

def from
  @from
end

- (Object) to

Returns the value of attribute to



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

def to
  @to
end

Instance Method Details

- (Object) extract_name(o)



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

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

- (Object) to_str



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

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