Skip to content

Commit

Permalink
Added tag name to DSL output comments and commented the new tags in p…
Browse files Browse the repository at this point in the history
…arser_spec
  • Loading branch information
Jack Chen committed Apr 17, 2010
1 parent e536e54 commit 7e0f0ab
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 23 deletions.
4 changes: 2 additions & 2 deletions lib/dmap.rb
Expand Up @@ -119,9 +119,9 @@ def to_dsl(level = 0)
pad = ' ' * (level * 2)
case value
when Array
(["#{pad}#{code} do"] + value.map{ |v| v.to_dsl(level + 1) } + ["#{pad}end"]).join("\n")
(["#{pad}#{code} do # #{@tag}"] + value.map{ |v| v.to_dsl(level + 1) } + ["#{pad}end"]).join("\n")
else
"#{pad}#{code} #{value.inspect}"
"#{pad}#{code} #{value.inspect} # #{@tag}"
end
end

Expand Down
6 changes: 3 additions & 3 deletions spec/dsl_spec.rb
Expand Up @@ -9,9 +9,9 @@
cmvo 88 # Volume
end
end.to_dsl.should == <<-STR.gsub(/^ /, '').strip
cmgt do
mstt 200
cmvo 88
cmgt do # unknown.list
mstt 200 # dmap.status
cmvo 88 # dmcp.volume
end
STR
end
Expand Down
36 changes: 18 additions & 18 deletions spec/parser_spec.rb
Expand Up @@ -50,24 +50,24 @@
it "parses cmst (player status)" do
DMAP.parse("cmst\000\000\001%mstt\000\000\000\004\000\000\000\310cmsr\000\000\000\004\000\000\000'caps\000\000\000\001\003cash\000\000\000\001\000carp\000\000\000\001\000cavc\000\000\000\001\001caas\000\000\000\004\000\000\000\002caar\000\000\000\004\000\000\000\006canp\000\000\000\020\000\000\000'\000\000(F\000\000(\266\000\000\016\375cann\000\000\000/Who Needs Forever? (Thievery Corporation remix)cana\000\000\000\017Astrud Gilbertocanl\000\000\000\rVerve Remixedcang\000\000\000\021Electronica/Danceasai\000\000\000\b}\026}\030\336\367Q\035cmmk\000\000\000\004\000\000\000\001ceGS\000\000\000\001\001cant\000\000\000\004\000\002 Gcast\000\000\000\004\000\003\335\024").should == DMAP.build do
cmst do
mstt 200
cmsr 39
caps 3
cash 0
carp 0
cavc 1
caas 2
caar 6
canp "\000\000\000'\000\000(F\000\000(\266\000\000\016\375"
cann "Who Needs Forever? (Thievery Corporation remix)"
cana "Astrud Gilberto"
canl "Verve Remixed"
cang "Electronica/Dance"
asai 9013529250002063645
cmmk 1
ceGS 1
cant 139335
cast 253204
mstt 200 # Status
cmsr 39 # Revision
caps 3 # Player state
cash 0 # Shuffle state
carp 0 # Repeat state
cavc 1 # Volume controllable
caas 2 # Avaliable shuffle states
caar 6 # Avaliable repeat states
canp "\000\000\000'\000\000(F\000\000(\266\000\000\016\375" # ??
cann "Who Needs Forever? (Thievery Corporation remix)" # Track name
cana "Astrud Gilberto" # Track artist
canl "Verve Remixed" # Track album
cang "Electronica/Dance" # Track genre
asai 9013529250002063645 # ??
cmmk 1 # ??
ceGS 1 # ?? something to do with DJ
cant 139335 # elapsed play time in milliseconds
cast 253204 # total play time in milliseconds
end
end
end
Expand Down

0 comments on commit 7e0f0ab

Please sign in to comment.