Sha256: 1f8835373c0352755afbc76133306594faff6123cf85931dc55133f706ac93ad
Contents?: true
Size: 1.3 KB
Versions: 24
Compression:
Stored size: 1.3 KB
Contents
module Rad::Router::AbstractRouter class Meta < Hash def get_class @klass ||= self[:class_name].constantize end end protected def parse_url_root options url_root = options[:url_root] url_root.must =~ /^\/.*/ if url_root url_root = nil if url_root == '/' url_root end def parse_prefix options prefix = Array(options[:prefix]) prefix.empty? ? nil : prefix end def encode_prefix_params! path, params, prefix parts = [] prefix.each do |name| value = params.delete(name) || (rad.workspace? && rad.workspace.params[name]) raise "not provided :#{name} prefix!" unless value parts << value.to_param.to_s.url_escape end "/#{parts.join('/')}#{path}" end # def encode_url_root! path, meta # if url_root = meta[:url_root] # "#{url_root}#{path}" # else # path # end # end def decode_prefix_params! parts, params, prefix prefix.each do |name| params[name] = parts.shift || raise("not provided :#{name} prefix!") end end def decode_url_root! parts, url_root raise 'not implemented' # raise "invalid :url_root!" if meta[:url_root] and meta[:url_root] != "/#{parts.join('/')}" end end
Version data entries
24 entries across 24 versions & 1 rubygems