Class: Kangaru::PathParser

Inherits:
Object
  • Object
show all
Defined in:
lib/kangaru/path_parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ PathParser

Returns a new instance of PathParser.



5
6
7
# File 'lib/kangaru/path_parser.rb', line 5

def initialize(path)
  @path = path
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



3
4
5
# File 'lib/kangaru/path_parser.rb', line 3

def path
  @path
end

Instance Method Details

#actionObject



13
14
15
# File 'lib/kangaru/path_parser.rb', line 13

def action
  match(:action, cast: :to_sym)
end

#controllerObject



9
10
11
# File 'lib/kangaru/path_parser.rb', line 9

def controller
  match(:controller)
end

#idObject



17
18
19
# File 'lib/kangaru/path_parser.rb', line 17

def id
  match(:id, cast: :to_i)
end