Class: Prawn::ManualBuilder::PrawnEncoder
- Inherits:
-
CodeRay::Encoders::Encoder
- Object
- CodeRay::Encoders::Encoder
- Prawn::ManualBuilder::PrawnEncoder
- Defined in:
- lib/prawn/manual_builder/syntax_highlight.rb
Overview
Registers a to_prawn method on CodeRay. It returns an array of hashes to be used with formatted_text.
Usage:
CodeRay.scan(string, :ruby).to_prawn
Constant Summary collapse
- COLORS =
{ :default => "FFFFFF", :comment => "AEAEAE", :constant => "88A5D2", :instance_variable => "E8ED97", :integer => "C8FF0E", :float => "C8FF0E", :inline_delimiter => "EF804F", # #{} within a string :keyword => "FEE100", # BUG: There appear to be some problem with this token. Method # definitions are considered as ident tokens # :method => "FF5C00", :string => "56D65E", :symbol => "C8FF0E" }
Instance Method Summary collapse
- #begin_group(kind) ⇒ Object
- #end_group(kind) ⇒ Object
- #setup(options) ⇒ Object
- #text_token(text, kind) ⇒ Object
Instance Method Details
#begin_group(kind) ⇒ Object
47 48 49 |
# File 'lib/prawn/manual_builder/syntax_highlight.rb', line 47 def begin_group(kind) @open << kind end |
#end_group(kind) ⇒ Object
51 52 53 |
# File 'lib/prawn/manual_builder/syntax_highlight.rb', line 51 def end_group(kind) @open.pop end |
#setup(options) ⇒ Object
35 36 37 38 39 |
# File 'lib/prawn/manual_builder/syntax_highlight.rb', line 35 def setup() super @out = [] @open = [] end |