Class: Util::Section

Inherits:
Object
  • Object
show all
Defined in:
lib/chordy/util/section.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_lengthObject

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_sObject



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