Sha256: e9dd1895bd0c6352c64e835f856759fd5a4387b1854d236e857551c723d1bc13
Contents?: true
Size: 614 Bytes
Versions: 2
Compression:
Stored size: 614 Bytes
Contents
module PartialFinder module Router def self.routes @@routes ||= `rake routes` end # Input string must be in the format controller_name#method, # ie "users_controller#create". # Returns a list of strings that correspond to the routes that # point to the given controller. def self.routes_from(controller_sig) entries = routes .scan(/^.+ \/(.+)\(\.:format\) +(#{controller_sig})/) .first if entries.present? entries .reject{ |a| a == controller_sig } .map{ |a| "/#{a}" } else [] end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
partial_finder-0.1.3 | lib/partial_finder/router.rb |
partial_finder-0.1.2 | lib/partial_finder/router.rb |