Module: BigBand::AdvancedRoutes::ClassMethods
- Defined in:
- lib/big_band/advanced_routes.rb
Instance Method Summary collapse
- #each_route(&block) ⇒ Object
- #get(path, opts = {}, &block) ⇒ Object
- #route(verb, path, options = {}, &block) ⇒ Object
Instance Method Details
#each_route(&block) ⇒ Object
161 162 163 164 |
# File 'lib/big_band/advanced_routes.rb', line 161 def each_route(&block) return enum_for(:each_route) if respond_to? :enum_for and not block routes.inject([]) { |result, (verb, list)| result.push *list.each(&block) } end |
#get(path, opts = {}, &block) ⇒ Object
145 146 147 148 149 |
# File 'lib/big_band/advanced_routes.rb', line 145 def get(path, opts={}, &block) first_route, *other_routes = capture_routes { super } first_route.also_change(*other_routes) first_route end |
#route(verb, path, options = {}, &block) ⇒ Object
151 152 153 154 155 156 157 158 159 |
# File 'lib/big_band/advanced_routes.rb', line 151 def route(verb, path, ={}, &block) file, line = block.source_location if block.respond_to? :source_location file ||= caller_files.first route = super(verb, path, , &block) route.to_route! verb, :app => self, :file => file., :line => line, :path => path invoke_hook :advanced_root_added, route @capture_routes << route if @capture_routes route end |