Class: IRealB::Parser::Tune
- Inherits:
-
Object
- Object
- IRealB::Parser::Tune
- Defined in:
- lib/irealb/parser/tune.rb
Instance Attribute Summary collapse
-
#chord_groupings ⇒ Object
Returns the value of attribute chord_groupings.
-
#composer ⇒ Object
Returns the value of attribute composer.
-
#key ⇒ Object
Returns the value of attribute key.
-
#name ⇒ Object
Returns the value of attribute name.
-
#style ⇒ Object
Returns the value of attribute style.
Instance Method Summary collapse
- #as_json(options = {}) ⇒ Object
-
#initialize(attributes = {}) ⇒ Tune
constructor
A new instance of Tune.
Constructor Details
#initialize(attributes = {}) ⇒ Tune
Returns a new instance of Tune.
10 11 12 13 14 15 16 |
# File 'lib/irealb/parser/tune.rb', line 10 def initialize(attributes = {}) self.chord_groupings = [] attributes.each do |key, value| self.send("#{key}=", value) if respond_to?(key) end end |
Instance Attribute Details
#chord_groupings ⇒ Object
Returns the value of attribute chord_groupings.
8 9 10 |
# File 'lib/irealb/parser/tune.rb', line 8 def chord_groupings @chord_groupings end |
#composer ⇒ Object
Returns the value of attribute composer.
5 6 7 |
# File 'lib/irealb/parser/tune.rb', line 5 def composer @composer end |
#key ⇒ Object
Returns the value of attribute key.
7 8 9 |
# File 'lib/irealb/parser/tune.rb', line 7 def key @key end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/irealb/parser/tune.rb', line 4 def name @name end |
#style ⇒ Object
Returns the value of attribute style.
6 7 8 |
# File 'lib/irealb/parser/tune.rb', line 6 def style @style end |
Instance Method Details
#as_json(options = {}) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/irealb/parser/tune.rb', line 18 def as_json( = {}) { :name => name, :composer => composer, :style => style, :key => key, :changes => chord_groupings.as_json }.reject {|k,v| v.nil? } end |