Class: Musa::MusicXML::Builder::Internal::Key
- Inherits:
-
Object
- Object
- Musa::MusicXML::Builder::Internal::Key
- Includes:
- Helper::ToXML
- Defined in:
- lib/musa-dsl/musicxml/builder/attributes.rb
Instance Attribute Summary collapse
-
#cancel ⇒ Object
Returns the value of attribute cancel.
-
#fifths ⇒ Object
Returns the value of attribute fifths.
-
#mode ⇒ Object
Returns the value of attribute mode.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
Instance Method Summary collapse
- #_to_xml(io, indent:, tabs:) ⇒ Object
-
#initialize(number = nil, cancel: nil, fifths:, mode: nil) ⇒ Key
constructor
A new instance of Key.
Methods included from Helper::ToXML
Constructor Details
#initialize(number = nil, cancel: nil, fifths:, mode: nil) ⇒ Key
Returns a new instance of Key.
12 13 14 15 16 17 18 |
# File 'lib/musa-dsl/musicxml/builder/attributes.rb', line 12 def initialize(number = nil, cancel: nil, fifths:, mode: nil) @number = number @cancel = cancel @fifths = fifths @mode = mode end |
Instance Attribute Details
#cancel ⇒ Object
Returns the value of attribute cancel.
21 22 23 |
# File 'lib/musa-dsl/musicxml/builder/attributes.rb', line 21 def cancel @cancel end |
#fifths ⇒ Object
Returns the value of attribute fifths.
21 22 23 |
# File 'lib/musa-dsl/musicxml/builder/attributes.rb', line 21 def fifths @fifths end |
#mode ⇒ Object
Returns the value of attribute mode.
21 22 23 |
# File 'lib/musa-dsl/musicxml/builder/attributes.rb', line 21 def mode @mode end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
20 21 22 |
# File 'lib/musa-dsl/musicxml/builder/attributes.rb', line 20 def number @number end |
Instance Method Details
#_to_xml(io, indent:, tabs:) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/musa-dsl/musicxml/builder/attributes.rb', line 23 def _to_xml(io, indent:, tabs:) io ||= StringIO.new indent ||= 0 tabs = "\t" * indent io.puts "#{tabs}<key#{" number=\"#{@number.to_i}\"" if @number}>" io.puts "#{tabs}\t<cancel>#{@cancel}</cancel>" if @cancel io.puts "#{tabs}\t<fifths>#{@fifths.to_i}</fifths>" io.puts "#{tabs}\t<mode>#{@mode}</mode>" io.puts "#{tabs}</key>" io end |