Class: IRealB::Parser::ChordGrouping

Inherits:
Object
  • Object
show all
Defined in:
lib/irealb/parser/chord_grouping.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ ChordGrouping

Returns a new instance of ChordGrouping.



11
12
13
14
15
16
17
# File 'lib/irealb/parser/chord_grouping.rb', line 11

def initialize(attributes = {})
  self.bars = []

  attributes.each do |key, value|
    self.send("#{key}=", value) if respond_to?(key)
  end
end

Instance Attribute Details

#barsObject

Returns the value of attribute bars.



7
8
9
# File 'lib/irealb/parser/chord_grouping.rb', line 7

def bars
  @bars
end

#codaObject

Returns the value of attribute coda.



9
10
11
# File 'lib/irealb/parser/chord_grouping.rb', line 9

def coda
  @coda
end

#endingsObject

Returns the value of attribute endings.



8
9
10
# File 'lib/irealb/parser/chord_grouping.rb', line 8

def endings
  @endings
end

#repeatObject

Returns the value of attribute repeat.



6
7
8
# File 'lib/irealb/parser/chord_grouping.rb', line 6

def repeat
  @repeat
end

#sectionObject

Returns the value of attribute section.



4
5
6
# File 'lib/irealb/parser/chord_grouping.rb', line 4

def section
  @section
end

#timeObject

Returns the value of attribute time.



5
6
7
# File 'lib/irealb/parser/chord_grouping.rb', line 5

def time
  @time
end

Instance Method Details

#as_json(options = {}) ⇒ Object



19
20
21
22
23
24
25
26
27
28
# File 'lib/irealb/parser/chord_grouping.rb', line 19

def as_json(options = {})
  {
    :section => section,
    :time => time,
    :repeat => repeat,
    :coda => coda,
    :bars => bars,
    :endings => endings
  }.reject {|k,v| v.nil? }
end