Mercurial > hg > soundsoftware-site
comparison vendor/gems/coderay-1.0.0/lib/coderay/encoders/yaml.rb @ 909:cbb26bc654de redmine-1.3
Update to Redmine 1.3-stable branch (Redmine SVN rev 8964)
author | Chris Cannam |
---|---|
date | Fri, 24 Feb 2012 19:09:32 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
908:c6c2cbd0afee | 909:cbb26bc654de |
---|---|
1 autoload :YAML, 'yaml' | |
2 | |
3 module CodeRay | |
4 module Encoders | |
5 | |
6 # = YAML Encoder | |
7 # | |
8 # Slow. | |
9 class YAML < Encoder | |
10 | |
11 register_for :yaml | |
12 | |
13 FILE_EXTENSION = 'yaml' | |
14 | |
15 protected | |
16 def setup options | |
17 super | |
18 | |
19 @data = [] | |
20 end | |
21 | |
22 def finish options | |
23 output ::YAML.dump(@data) | |
24 end | |
25 | |
26 public | |
27 def text_token text, kind | |
28 @data << [text, kind] | |
29 end | |
30 | |
31 def begin_group kind | |
32 @data << [:begin_group, kind] | |
33 end | |
34 | |
35 def end_group kind | |
36 @data << [:end_group, kind] | |
37 end | |
38 | |
39 def begin_line kind | |
40 @data << [:begin_line, kind] | |
41 end | |
42 | |
43 def end_line kind | |
44 @data << [:end_line, kind] | |
45 end | |
46 | |
47 end | |
48 | |
49 end | |
50 end |