Class: Chordproko::ChordGroup

Inherits:
Object
  • Object
show all
Defined in:
lib/chordproko/chord_group.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(content) ⇒ ChordGroup

Returns a new instance of ChordGroup.



4
5
6
7
# File 'lib/chordproko/chord_group.rb', line 4

def initialize content
  @content = content
  @key = 0
end

Instance Attribute Details

#contentObject

Returns the value of attribute content.



3
4
5
# File 'lib/chordproko/chord_group.rb', line 3

def content
  @content
end

#keyObject

Returns the value of attribute key.



3
4
5
# File 'lib/chordproko/chord_group.rb', line 3

def key
  @key
end

Instance Method Details

#each(&block) ⇒ Object



8
9
10
# File 'lib/chordproko/chord_group.rb', line 8

def each(&block)
  [self].each(&block)
end

#to_sObject



11
12
13
14
15
16
17
18
# File 'lib/chordproko/chord_group.rb', line 11

def to_s
  @content.each do |c|
    if c.class.to_s == "Chordproko::Chord"
      c.key = @key
    end
    c.to_s
  end.join
end