Closed andrew2net closed 7 months ago
The #to_h method returns Hash with Parslet::Slice values:
#to_h
Hash
Parslet::Slice
> hash = Pubid::Iso::Identifier.parse('ISO/CD 16659-2').to_h => {:publisher=>"ISO", :number=>"16659"@7, :stage=>"CD", :part=>"2"@13, :edition=>nil, :type=>:is} > hash[:number].class => Parslet::Slice
when the hash is stored in YAML it becomes:
... - :id: :publisher: ISO :number: !ruby/object:Parslet::Slice position: !ruby/object:Parslet::Position string: ISO/CD 16659-2 bytepos: 7 str: '16659' line_cache: &8 !ruby/object:Parslet::Source::LineCache line_ends: [] last_line_end: :stage: CD :part: !ruby/object:Parslet::Slice position: !ruby/object:Parslet::Position string: ISO/CD 16659-2 bytepos: 13 str: '2' line_cache: *8 :type: :is ...
it should be:
... - :id: :publisher: ISO :number: '16659' :stage: CD :part: '2' :type: :is ...
The
#to_h
method returnsHash
withParslet::Slice
values:when the hash is stored in YAML it becomes:
it should be: