Class: Palette::Link
- Inherits:
-
Object
- Object
- Palette::Link
- Defined in:
- lib/palette/link.rb
Constant Summary collapse
- @@max_length =
0
Instance Attribute Summary collapse
-
#from ⇒ Object
readonly
Returns the value of attribute from.
-
#to ⇒ Object
readonly
Returns the value of attribute to.
Instance Method Summary collapse
-
#initialize(from, to) ⇒ Link
constructor
A new instance of Link.
- #to_s ⇒ Object
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
#from ⇒ Object (readonly)
Returns the value of attribute from.
4 5 6 |
# File 'lib/palette/link.rb', line 4 def from @from end |
#to ⇒ Object (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_s ⇒ Object
12 13 14 |
# File 'lib/palette/link.rb', line 12 def to_s %{hi link #{sprintf("%-#{@@max_length}s", self.from)} #{self.to}} end |