module Noid::Rails

A package to integrate Noid identifers with Rails projects

Constants

VERSION

Public Class Methods

config() click to toggle source
# File lib/noid-rails.rb, line 17
def config
  @config ||= Config.new
end
configure() { |config| ... } click to toggle source
# File lib/noid-rails.rb, line 13
def configure
  yield config
end
treeify(identifier) click to toggle source
# File lib/noid-rails.rb, line 21
def treeify(identifier)
  raise ArgumentError, 'Identifier must be a string of size > 0 in order to be treeified' if identifier.blank?
  head = identifier.split('/').first
  head.gsub!(/#.*/, '')
  (head.scan(/..?/).first(4) + [identifier]).join('/')
end