Module: Orange::Pulp::Packet_Mapper
- Defined in:
- lib/orange-core/resources/mapper.rb
Instance Method Summary collapse
- #full_url(*args) ⇒ Object
- #reroute(url, type = :real, *args) ⇒ Object
- #root_url ⇒ Object
- #route_to(resource, *args) ⇒ Object
Instance Method Details
#full_url(*args) ⇒ Object
43 44 45 |
# File 'lib/orange-core/resources/mapper.rb', line 43 def full_url(*args) orange[:mapper].root_url(packet) + args.compact.join('/') end |
#reroute(url, type = :real, *args) ⇒ Object
47 48 49 50 51 52 |
# File 'lib/orange-core/resources/mapper.rb', line 47 def reroute(url, type = :real, *args) packet['reroute.to'] = url packet['reroute.type'] = type packet['reroute.args'] = *args if args raise Reroute.new(self), 'Unhandled reroute' end |
#root_url ⇒ Object
39 40 41 |
# File 'lib/orange-core/resources/mapper.rb', line 39 def root_url orange[:mapper].root_url(packet) end |
#route_to(resource, *args) ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/orange-core/resources/mapper.rb', line 31 def route_to(resource, *args) if resource.respond_to?(:full_path) orange[:mapper].root_url(packet) + resource.full_path.gsub(/^\//,'') else orange[:mapper].route_to(self, resource, *args) end end |