Class: Palette::Link

Inherits:
Object
  • Object
show all
Defined in:
lib/palette/link.rb

Constant Summary collapse

@@max_length =
0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(from, to) ⇒ Link

Returns a new instance of Link.



6
7
8
9
10
# File 'lib/palette/link.rb', line 6

def initialize(from, to)
  @from = from.to_s
  @to   = to.to_s
  @@max_length = @from.length if @from.length > @@max_length
end

Instance Attribute Details

#fromObject (readonly)

Returns the value of attribute from.



4
5
6
# File 'lib/palette/link.rb', line 4

def from
  @from
end

#toObject (readonly)

Returns the value of attribute to.



4
5
6
# File 'lib/palette/link.rb', line 4

def to
  @to
end

Instance Method Details

#to_sObject



12
13
14
# File 'lib/palette/link.rb', line 12

def to_s
  %{hi link #{sprintf("%-#{@@max_length}s", self.from)} #{self.to}}
end