Sha256: fdb3259093f908bf727ba9b421a696caacd0d912a42524bd40e8ef6d1f0e5f53

Contents?: true

Size: 957 Bytes

Versions: 24

Compression:

Stored size: 957 Bytes

Contents

module RouteHelper
  #Manage Controller prefixes
  #@prefix is an Array, but this method returns a string
  #suitable for prefixing onto a controller name.
  def prefix
    if @prefix.length > 0
      @prefix.join("::") << "::"
    else
      ''
    end
  end

  #Sets the controller name to a proper class name.
  #For example
  # self.current_controller = :session
  # @controller == :SessionController #true
  #
  #Also prepends the prefix if there is one set.
  def current_controller= name
    @current_controller = (prefix + camelize(name) + "Controller").to_sym
    @tracker.routes[@current_controller] ||= Set.new
  end

  #Add default routes
  def add_resources_routes
    @tracker.routes[@current_controller].merge [:index, :new, :create, :show, :edit, :update, :destroy]
  end


  #Add default routes minus :index
  def add_resource_routes
    @tracker.routes[@current_controller].merge [:new, :create, :show, :edit, :update, :destroy]
  end
end

Version data entries

24 entries across 24 versions & 2 rubygems

Version Path
brakeman-0.9.2 lib/processors/lib/route_helper.rb
brakeman-0.9.1 lib/processors/lib/route_helper.rb
brakeman-0.9.0 lib/processors/lib/route_helper.rb
brakeman-0.8.4 lib/processors/lib/route_helper.rb
brakeman-0.8.3 lib/processors/lib/route_helper.rb
brakeman-0.8.2 lib/processors/lib/route_helper.rb
brakeman-0.8.1 lib/processors/lib/route_helper.rb
brakeman-0.8.0 lib/processors/lib/route_helper.rb
brakeman-0.7.2 lib/processors/lib/route_helper.rb
brakeman-0.7.1 lib/processors/lib/route_helper.rb
brakeman-0.7.0 lib/processors/lib/route_helper.rb
brakeman-0.6.1 lib/processors/lib/route_helper.rb
brakeman-0.6.0 lib/processors/lib/route_helper.rb
brakeman-min-0.5.2 lib/processors/lib/route_helper.rb
brakeman-0.5.2 lib/processors/lib/route_helper.rb
brakeman-min-0.5.1 lib/processors/lib/route_helper.rb
brakeman-0.5.1 lib/processors/lib/route_helper.rb
brakeman-min-0.5.0 lib/processors/lib/route_helper.rb
brakeman-0.5.0 lib/processors/lib/route_helper.rb
brakeman-0.4.1 lib/processors/lib/route_helper.rb