Module: Stupidedi::Inspect
- Included in:
- Builder::AbstractState, Builder::BuilderDsl, Builder::Instruction, Builder::InstructionTable, Builder::StateMachine, Config, Config::CodeListConfig, Config::EditorConfig, Config::FunctionalGroupConfig, Config::InterchangeConfig, Config::TransactionSetConfig, Editor::AbstractEd, Editor::ResultSet, Reader::AbstractInput, Reader::ComponentElementTok, Reader::CompositeElementTok, Reader::Position, Reader::RepeatedElementTok, Reader::SegmentDict, Reader::SegmentTok, Reader::SimpleElementTok, Reader::StreamReader, Reader::TokenReader, Schema::AbstractElementDef, Schema::AbstractElementUse, Schema::CodeList, Schema::FunctionalGroupDef, Schema::InterchangeDef, Schema::LoopDef, Schema::SegmentDef, Schema::SegmentUse, Schema::TransactionSetDef, Sets::AbstractSet, ThreadLocalHash, ThreadLocalVar, Values::AbstractVal
- Defined in:
- lib/stupidedi/inspect.rb
Overview
When an exception is raised, in some cases #inspect is called on a
huge object graph to generate the message "undefined method '...' for
<Stupidedi::Schema::TransactionSetDef:0x...>". This can take several
seconds, since Object#inspect descends recursively into each instance
variable.
This mixin defines an alternative default implementation for #inspect,
which should be significantly faster than the default Ruby implementation
since it does not descend into the object.
Instance Method Summary (collapse)
Instance Method Details
- (String) inspect
17 18 19 20 21 22 23 |
# File 'lib/stupidedi/inspect.rb', line 17 def inspect if self.class.name.empty? "#<\#<Class:0x#{self.class.object_id.abs.to_s(16)}>" else "#<#{self.class.name}" end << ":0x#{object_id.abs.to_s(16)} ...>" end |