class Restruct::Id

Attributes

separator[R]

Public Class Methods

[](id) click to toggle source
# File lib/restruct/id.rb, line 6
def self.[](id)
  new id
end
new(id, separator=nil) click to toggle source
Calls superclass method
# File lib/restruct/id.rb, line 10
def initialize(id, separator=nil)
  @separator = separator || Restruct.id_separator
  super id.to_s
end

Public Instance Methods

[](id) click to toggle source
# File lib/restruct/id.rb, line 15
def [](id)
  Id.new "#{to_s}#{separator}#{id}", separator
end
sections() click to toggle source
# File lib/restruct/id.rb, line 19
def sections
  split(separator).map { |s| Id.new s, separator }
end