Module: Eastwood::Context

Defined in:
lib/eastwood/context.rb

Defined Under Namespace

Classes: HashRoute, Route

Instance Method Summary collapse

Instance Method Details

#appObject



46
47
48
# File 'lib/eastwood/context.rb', line 46

def app
  Rails.application.class.name.split( '::' ).first
end

#envObject



50
51
52
# File 'lib/eastwood/context.rb', line 50

def env
  Rails.env
end

#hashesObject



61
62
63
64
65
66
# File 'lib/eastwood/context.rb', line 61

def hashes
  # 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_hashes.merge( named_hashes ){ |key, hash| HashRoute.new key, hash }
end

#route_formatObject



68
69
70
# File 'lib/eastwood/context.rb', line 68

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

#routesObject



54
55
56
57
58
59
# File 'lib/eastwood/context.rb', line 54

def 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.new route, route_format }
end