Class: Orange::Mapper

Inherits:
Resource show all
Defined in:
lib/orange-core/resources/mapper.rb

Instance Method Summary collapse

Methods inherited from Resource

call_me, #do_view, #find_extras, #init, #initialize, #options, #orange, #orange_name, #routable, #set_orange, set_orange, #view, #view_opts

Methods included from ClassInheritableAttributes

#cattr_accessor, #cattr_reader, #cattr_writer, eval_in_accessor_module, fetch_value, store_value

Constructor Details

This class inherits a constructor from Orange::Resource

Instance Method Details

#afterLoadObject

Takes a packet extracts request information, then calls packet.route



6
7
8
# File 'lib/orange-core/resources/mapper.rb', line 6

def afterLoad
  orange.add_pulp Pulp::Packet_Mapper
end

#route_to(packet, resource, *args) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/orange-core/resources/mapper.rb', line 10

def route_to(packet, resource, *args)
  opts = args.extract_options!
  packet = DefaultHash.new unless packet 
  context = opts[:context]
  context = packet['route.context', nil] unless (context || (packet['route.context'] == :live))
  site = packet['route.faked_site'] ? packet['route.site_url', nil] : nil
  args.unshift(resource)
  args.unshift(context)
  args.unshift(site)
  '/'+args.compact.join('/')
end