Class: Eastwood::Context::ClientRoute

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from RouteHelpers

#style_for_javascript

Instance Attribute Details

#keyObject

Returns the value of attribute key

Returns:

  • (Object)

    the current value of key



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

def key
  @key
end

#routeObject

Returns the value of attribute route

Returns:

  • (Object)

    the current value of route



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

def route
  @route
end

#suffixObject

Returns the value of attribute suffix

Returns:

  • (Object)

    the current value of suffix



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

def suffix
  @suffix
end

Instance Method Details

#coffee_argsObject



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

def coffee_args
  parts.join ', '
end

#coffee_nameObject



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

def coffee_name
  style_for_javascript "#{name}_#{suffix}"
end

#coffee_pathObject



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

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

#nameObject



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

def name
  key.to_s
end

#partsObject



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

def parts
  route.scan( /:(\w+)/ ).flatten.map &:to_sym
end

#pathObject



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

def path
  route
end