Skip to content

Commit

Permalink
ParsedScore -> Score
Browse files Browse the repository at this point in the history
  • Loading branch information
igneus committed Mar 6, 2016
1 parent 31a9eda commit 982d5d9
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/gly.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module Gly; end
%w(parser
exceptions
gabc_convertor
parsed_score
score
headers
lyrics
markup
Expand Down
2 changes: 1 addition & 1 deletion lib/gly/document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def initialize
def <<(score)
@content << score

if score.is_a? ParsedScore
if score.is_a? Score
@scores << score

sid = score.headers['id']
Expand Down
2 changes: 1 addition & 1 deletion lib/gly/gabc_convertor.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'stringio'

module Gly
# takes ParsedScore, translates it to gabc
# takes Score, translates it to gabc
class GabcConvertor
def convert(score, out=StringIO.new)
score.headers.each_pair do |key,value|
Expand Down
6 changes: 3 additions & 3 deletions lib/gly/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def parse_str(str)

def parse_io(io)
@doc = Document.new
@score = ParsedScore.new
@score = Score.new

if io.respond_to? :path
@doc.path = io.path
Expand All @@ -48,7 +48,7 @@ def parse_io(io)
# keywords specifying line or block type
elsif new_score? line
push_score
@score = ParsedScore.new
@score = Score.new
@current_block = :score
elsif header_start? line
push_score
Expand Down Expand Up @@ -188,7 +188,7 @@ def parse_default(line)
end

def push_score
if @score.is_a?(ParsedScore) && !@score.empty?
if @score.is_a?(Score) && !@score.empty?
begin
@doc << @score
rescue ArgumentError => ex
Expand Down
2 changes: 1 addition & 1 deletion lib/gly/parsed_score.rb → lib/gly/score.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module Gly
# result of a gly score parsing
class ParsedScore
class Score
def initialize
@headers = Headers.new
@lyrics = Lyrics.new
Expand Down
6 changes: 3 additions & 3 deletions tests/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ def test_score_markup_order

assert_equal 6, doc.content.size

assert_instance_of Gly::ParsedScore, doc.content[0]
assert_instance_of Gly::Score, doc.content[0]
assert_equal 'a', doc.content[0].headers['id']

assert_instance_of Gly::Markup, doc.content[1]
assert_equal 'a', doc.content[1].text

assert_instance_of Gly::ParsedScore, doc.content[2]
assert_instance_of Gly::Score, doc.content[2]
assert_equal 'b', doc.content[2].headers['id']

assert_instance_of Gly::Markup, doc.content[3]
Expand All @@ -37,7 +37,7 @@ def test_score_markup_order
assert_instance_of Gly::Markup, doc.content[4]
assert_equal 'c', doc.content[4].text

assert_instance_of Gly::ParsedScore, doc.content[5]
assert_instance_of Gly::Score, doc.content[5]
assert_equal 'c', doc.content[5].headers['id']
end

Expand Down

0 comments on commit 982d5d9

Please sign in to comment.