Module: Eastwood::Context

Defined in:
lib/eastwood.rb,
lib/eastwood/context.rb,
lib/eastwood/context/action_route.rb,
lib/eastwood/context/client_route.rb,
lib/eastwood/context/journey_route.rb,
lib/eastwood/context/route_helpers.rb

Defined Under Namespace

Modules: RouteHelpers Classes: ActionRoute, ClientRoute, JourneyRoute

Instance Method Summary collapse

Instance Method Details

#appObject



4
5
6
# File 'lib/eastwood/context.rb', line 4

def app
  Eastwood.javascript_namespace or Eastwood.application_name
end

#client_routesObject



23
24
25
26
27
28
# File 'lib/eastwood/context.rb', line 23

def client_routes
  # TODO would kind of like to find a better way to transform
  # these values into my routes, but keep as a hash
  # http://www.ruby-forum.com/topic/185611
  custom_routes.merge( custom_routes ){ |key, (route, suffix)| ClientRoute.new key, route, suffix }
end

#envObject



8
9
10
# File 'lib/eastwood/context.rb', line 8

def env
  Eastwood.env
end

#exportsObject



30
31
32
# File 'lib/eastwood/context.rb', line 30

def exports
  Eastwood.exports
end

#route_formatObject



34
35
36
# File 'lib/eastwood/context.rb', line 34

def route_format
  omit_route_format? ? '' : ".#{Eastwood.default_route_format.to_s}"
end

#server_routesObject



16
17
18
19
20
21
# File 'lib/eastwood/context.rb', line 16

def server_routes
  # TODO would kind of like to find a better way to transform
  # these values into my routes, but keep as a hash
  # http://www.ruby-forum.com/topic/185611
  named_routes.merge( named_routes ) { |key, route| route_class.new route, route_format }
end

#targetObject



12
13
14
# File 'lib/eastwood/context.rb', line 12

def target
  env === 'test' ? '( @window ||= { } )' : 'window'
end