Class: Util::Section
- Inherits:
-
Object
- Object
- Util::Section
- Defined in:
- lib/chordy/util/section.rb
Instance Attribute Summary collapse
-
#separator_length ⇒ Object
Returns the value of attribute separator_length.
Instance Method Summary collapse
-
#initialize(title = "", separator_length = 40) ⇒ Section
constructor
A new instance of Section.
- #to_s ⇒ Object
Constructor Details
#initialize(title = "", separator_length = 40) ⇒ Section
Returns a new instance of Section.
6 7 8 9 |
# File 'lib/chordy/util/section.rb', line 6 def initialize(title="", separator_length=40) @title = title @separator_length = separator_length end |
Instance Attribute Details
#separator_length ⇒ Object
Returns the value of attribute separator_length.
4 5 6 |
# File 'lib/chordy/util/section.rb', line 4 def separator_length @separator_length end |
Instance Method Details
#to_s ⇒ Object
11 12 13 14 |
# File 'lib/chordy/util/section.rb', line 11 def to_s title_str = @title.to_s title_str.rjust(title_str.length + 2, "-").ljust(@separator_length, "-") end |