Class: RASN1::Tracer
- Inherits:
-
Object
- Object
- RASN1::Tracer
- Defined in:
- lib/rasn1/tracer.rb
Constant Summary collapse
- TRACED_CLASSES =
[Types::Any, Types::Choice, Types::Sequence, Types::SequenceOf, Types::Base].freeze
Instance Attribute Summary collapse
- #io ⇒ IO readonly
- #tracing_level ⇒ Integer
Instance Method Summary collapse
-
#indent(level = nil) ⇒ String
Return identation for given
level. -
#initialize(io) ⇒ Tracer
constructor
A new instance of Tracer.
-
#trace(msg) ⇒ void
Puts
msgonto #io.
Constructor Details
#initialize(io) ⇒ Tracer
Returns a new instance of Tracer.
20 21 22 23 |
# File 'lib/rasn1/tracer.rb', line 20 def initialize(io) @io = io @tracing_level = 0 end |
Instance Attribute Details
#io ⇒ IO (readonly)
13 14 15 |
# File 'lib/rasn1/tracer.rb', line 13 def io @io end |
#tracing_level ⇒ Integer
15 16 17 |
# File 'lib/rasn1/tracer.rb', line 15 def tracing_level @tracing_level end |
Instance Method Details
#indent(level = nil) ⇒ String
Return identation for given level. If nil, use #tracing_level.
35 36 37 38 |
# File 'lib/rasn1/tracer.rb', line 35 def indent(level=nil) level ||= @tracing_level ' ' * level end |
#trace(msg) ⇒ void
This method returns an undefined value.
Puts msg onto #io.
28 29 30 |
# File 'lib/rasn1/tracer.rb', line 28 def trace(msg) @io.puts(indent << msg) end |