Class: Eastwood::Context::Route

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#formatObject

Returns the value of attribute format

Returns:

  • (Object)

    the current value of format



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

def format
  @format
end

#routeObject

Returns the value of attribute route

Returns:

  • (Object)

    the current value of route



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

def route
  @route
end

Instance Method Details

#coffee_argsObject



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

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

#coffee_nameObject



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

def coffee_name
  "#{name}_path"
end

#coffee_pathObject



20
21
22
# File 'lib/eastwood/context.rb', line 20

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

#nameObject



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

def name
  route.name
end

#partsObject



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

def parts
  route.parts
end

#pathObject



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

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