Sha256: 2779297ca3539c1ee5950d8d45b6df2e6f2532d044a21ed0f6dbeefdb7c5b61d

Contents?: true

Size: 451 Bytes

Versions: 1

Compression:

Stored size: 451 Bytes

Contents

module MusicXML
  class Parser

    attr_reader :filepath, :score

    def initialize(filepath)
      @filepath = filepath
      validate_filepath
    end

    def parse
      document = Nokogiri::XML(File.read(filepath))
      @score = Node::ScorePartwise.new(document.at('score-partwise'))
    end

    private

    def validate_filepath
      raise ArgumentError, "Invalid filepath given: #{filepath}" unless File.file?(filepath)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
musicxml-0.0.1 lib/musicxml/parser.rb