Module: Stupidedi::Inspect
- Included in:
- Config, Config::CodeListConfig, Config::EditorConfig, Config::FunctionalGroupConfig, Config::InterchangeConfig, Config::TransactionSetConfig, Editor::AbstractEd, Editor::ResultSet, Parser::AbstractState, Parser::BuilderDsl, Parser::Instruction, Parser::InstructionTable, Parser::StateMachine, Reader::AbstractInput, Reader::ComponentElementTok, Reader::CompositeElementTok, 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, 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
#inspect ⇒ String
18 19 20 21 22 23 24 |
# File 'lib/stupidedi/inspect.rb', line 18 def inspect if self.class.name.nil? or self.class.name !~ /\S/ "#<\#<Class:0x#{self.class.object_id.abs.to_s(16)}>" else "#<#{self.class.name}" end + ":0x#{object_id.abs.to_s(16)} ...>" end |