Class: HexaPDF::CLI::Inspect::ContentProcessor
- Inherits:
-
HexaPDF::Content::Processor
- Object
- HexaPDF::Content::Processor
- HexaPDF::CLI::Inspect::ContentProcessor
- Defined in:
- lib/hexapdf/cli/inspect.rb
Overview
Outputs the content of a page in a nicer form.
Constant Summary
Constants inherited from HexaPDF::Content::Processor
HexaPDF::Content::Processor::OPERATOR_MESSAGE_NAME_MAP
Instance Attribute Summary
Attributes inherited from HexaPDF::Content::Processor
#graphics_object, #graphics_state, #operators, #resources
Instance Method Summary collapse
-
#initialize ⇒ ContentProcessor
constructor
:nodoc:.
-
#method_missing(operator, *operands) ⇒ Object
:nodoc:.
-
#paint_xobject(name) ⇒ Object
:nodoc:.
-
#respond_to_missing? ⇒ Boolean
:nodoc:.
Methods inherited from HexaPDF::Content::Processor
Constructor Details
#initialize ⇒ ContentProcessor
:nodoc:
49 50 51 52 53 |
# File 'lib/hexapdf/cli/inspect.rb', line 49 def initialize(*) super @indent = 0 @serializer = HexaPDF::Serializer.new end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(operator, *operands) ⇒ Object
:nodoc:
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/hexapdf/cli/inspect.rb', line 64 def method_missing(operator, *operands) case operator when :save_graphics_state, :begin_text, :begin_marked_content puts "#{indent}#{operator}" @indent += 1 when :restore_graphics_state, :end_text, :end_marked_content @indent -= 1 puts "#{indent}#{operator}" when :show_text, :show_text_with_positioning puts "#{indent}text> #{decode_text(*operands)}" else puts "#{indent}#{operator} #{operands.map {|op| @serializer.serialize(op) }.join(' ')}" @indent += 1 if operator == :begin_marked_content_with_property_list end end |
Instance Method Details
#paint_xobject(name) ⇒ Object
:nodoc:
56 57 58 59 60 61 |
# File 'lib/hexapdf/cli/inspect.rb', line 56 def paint_xobject(name) puts "#{indent}paint_xobject #{@serializer.serialize(name)}" @indent += 1 super @indent -= 1 end |
#respond_to_missing? ⇒ Boolean
:nodoc:
81 82 83 |
# File 'lib/hexapdf/cli/inspect.rb', line 81 def respond_to_missing?(*) true end |