Class: Eastwood::Context::JourneyRoute

Inherits:
Struct
  • Object
show all
Includes:
RouteHelpers
Defined in:
lib/eastwood/context/journey_route.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from RouteHelpers

#style_for_javascript

Instance Attribute Details

#formatObject

Returns the value of attribute format

Returns:

  • (Object)

    the current value of format



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

def format
  @format
end

#routeObject

Returns the value of attribute route

Returns:

  • (Object)

    the current value of route



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

def route
  @route
end

Instance Method Details

#coffee_argsObject



22
23
24
# File 'lib/eastwood/context/journey_route.rb', line 22

def coffee_args
  parts.any? ? "#{parts.join( ', ' )}='#{format}'" : ''
end

#coffee_nameObject



18
19
20
# File 'lib/eastwood/context/journey_route.rb', line 18

def coffee_name
  style_for_javascript "#{name}_path"
end

#coffee_pathObject



26
27
28
# File 'lib/eastwood/context/journey_route.rb', line 26

def coffee_path
  path.delete( '.' ).gsub /:(\w+)/, '#{\1}'
end

#nameObject



6
7
8
# File 'lib/eastwood/context/journey_route.rb', line 6

def name
  route.name
end

#partsObject



10
11
12
# File 'lib/eastwood/context/journey_route.rb', line 10

def parts
  route.parts
end

#pathObject



14
15
16
# File 'lib/eastwood/context/journey_route.rb', line 14

def path
  route.path.spec.to_s.delete '()'
end