Sha256: 8501c223a2d2b7d26f12667e7e2247808fa4c0b4c78bcb106134cd04146b088c
Contents?: true
Size: 355 Bytes
Versions: 4
Compression:
Stored size: 355 Bytes
Contents
module Restruct class Id < String attr_reader :separator def initialize(id, separator=nil) @separator = separator || Restruct.id_separator super id.to_s end def [](id) Id.new "#{to_s}#{separator}#{id}", separator end def sections split(separator).map { |s| Id.new s, separator } end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
restruct-0.1.0 | lib/restruct/id.rb |
restruct-0.0.3 | lib/restruct/id.rb |
restruct-0.0.2 | lib/restruct/id.rb |
restruct-0.0.1 | lib/restruct/id.rb |