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
msg
onto #io.
Constructor Details
#initialize(io) ⇒ Tracer
Returns a new instance of Tracer.
14 15 16 17 |
# File 'lib/rasn1/tracer.rb', line 14 def initialize(io) @io = io @tracing_level = 0 end |
Instance Attribute Details
#io ⇒ IO (readonly)
7 8 9 |
# File 'lib/rasn1/tracer.rb', line 7 def io @io end |
#tracing_level ⇒ Integer
9 10 11 |
# File 'lib/rasn1/tracer.rb', line 9 def tracing_level @tracing_level end |
Instance Method Details
#indent(level = nil) ⇒ String
Return identation for given level
. If nil
, use #tracing_level.
29 30 31 32 |
# File 'lib/rasn1/tracer.rb', line 29 def indent(level=nil) level ||= @tracing_level ' ' * level end |
#trace(msg) ⇒ void
This method returns an undefined value.
Puts msg
onto #io.
22 23 24 |
# File 'lib/rasn1/tracer.rb', line 22 def trace(msg) @io.puts(indent << msg) end |