Sha256: 9e3e54e99275cc99632716d7577ad9eda825def224a57e0a1b0d62d699103d30

Contents?: true

Size: 495 Bytes

Versions: 24

Compression:

Stored size: 495 Bytes

Contents

class Rad::Router::SimpleRouter    
  inject logger: :logger

  def encode klass, method, params
    path = "/#{klass.name.underscore}/#{method}"      
    return path, params
  end

  def decode path, params
    parts = path[1..-1].split '/'
    if parts.size >= 2
      method = parts.pop.to_sym
    
      class_path = parts.join('/')
      class_name = class_path.camelize        
      klass = class_name.constantize
                    
      return klass, method, params
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
rad_core-0.2.6 lib/rad/router/_simple_router.rb
rad_core-0.2.5 lib/rad/router/_simple_router.rb
rad_core-0.2.4 lib/rad/router/_simple_router.rb
rad_core-0.2.3 lib/rad/router/_simple_router.rb
rad_core-0.2.2 lib/rad/router/_simple_router.rb
rad_core-0.2.1 lib/rad/router/_simple_router.rb
rad_core-0.2.0 lib/rad/router/_simple_router.rb
rad_core-0.0.30 lib/rad/router/_simple_router.rb
rad_core-0.0.29 lib/rad/router/_simple_router.rb
rad_core-0.0.28 lib/rad/router/_simple_router.rb
rad_core-0.0.27 lib/rad/router/_simple_router.rb
rad_core-0.0.26 lib/rad/router/_simple_router.rb
rad_core-0.0.25 lib/rad/router/_simple_router.rb
rad_core-0.0.24 lib/rad/router/_simple_router.rb
rad_core-0.0.23 lib/rad/router/_simple_router.rb
rad_core-0.0.22 lib/rad/router/_simple_router.rb
rad_core-0.0.21 lib/rad/router/_simple_router.rb
rad_core-0.0.20 lib/rad/router/_simple_router.rb
rad_core-0.0.19 lib/rad/router/_simple_router.rb
rad_core-0.0.18 lib/rad/router/_simple_router.rb