Class: Musa::MusicXML::Builder::Internal::Clef

Inherits:
Object
  • Object
show all
Includes:
Helper::ToXML
Defined in:
lib/musa-dsl/musicxml/builder/attributes.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helper::ToXML

#to_xml

Constructor Details

#initialize(number = nil, sign:, line:, octave_change: nil) ⇒ Clef

Returns a new instance of Clef.



77
78
79
80
81
82
# File 'lib/musa-dsl/musicxml/builder/attributes.rb', line 77

def initialize(number = nil, sign:, line:, octave_change: nil)
  @number = number
  @sign = sign
  @line = line
  @octave_change = octave_change
end

Instance Attribute Details

#lineObject

Returns the value of attribute line.



85
86
87
# File 'lib/musa-dsl/musicxml/builder/attributes.rb', line 85

def line
  @line
end

#numberObject (readonly)

Returns the value of attribute number.



84
85
86
# File 'lib/musa-dsl/musicxml/builder/attributes.rb', line 84

def number
  @number
end

#octave_changeObject

Returns the value of attribute octave_change.



85
86
87
# File 'lib/musa-dsl/musicxml/builder/attributes.rb', line 85

def octave_change
  @octave_change
end

#signObject

Returns the value of attribute sign.



85
86
87
# File 'lib/musa-dsl/musicxml/builder/attributes.rb', line 85

def sign
  @sign
end

Instance Method Details

#_to_xml(io, indent:, tabs:) ⇒ Object



87
88
89
90
91
92
93
94
95
# File 'lib/musa-dsl/musicxml/builder/attributes.rb', line 87

def _to_xml(io, indent:, tabs:)
  io.puts "#{tabs}<clef#{" number=\"#{@number.to_i}\"" if @number}>"

  io.puts "#{tabs}\t<sign>#{@sign}</sign>"
  io.puts "#{tabs}\t<line>#{@line.to_i}</line>" if @line
  io.puts "#{tabs}\t<clef-octave-change>#{@octave_change.to_i}</clef-octave-change>" if @octave_change

  io.puts "#{tabs}</clef>"
end