Class: Chespirito::RouteUtils
- Inherits:
-
Object
- Object
- Chespirito::RouteUtils
- Defined in:
- lib/chespirito/routes/route_utils.rb
Class Method Summary collapse
- .constraint?(word) ⇒ Boolean
- .constraints(path) ⇒ Object
- .part?(word) ⇒ Boolean
- .parts(path) ⇒ Object
- .remove_colon(word) ⇒ Object
- .words(path) ⇒ Object
Class Method Details
.constraint?(word) ⇒ Boolean
10 |
# File 'lib/chespirito/routes/route_utils.rb', line 10 def constraint?(word) = word.start_with?(":") |
.constraints(path) ⇒ Object
7 |
# File 'lib/chespirito/routes/route_utils.rb', line 7 def constraints(path) = words(path).select(&method(:constraint?)).map(&method(:remove_colon)) |
.part?(word) ⇒ Boolean
9 |
# File 'lib/chespirito/routes/route_utils.rb', line 9 def part?(word) = !constraint?(word) |
.parts(path) ⇒ Object
8 |
# File 'lib/chespirito/routes/route_utils.rb', line 8 def parts(path) = words(path).select(&method(:part?)) |
.remove_colon(word) ⇒ Object
11 |
# File 'lib/chespirito/routes/route_utils.rb', line 11 def remove_colon(word) = word.gsub(":", '') |
.words(path) ⇒ Object
6 |
# File 'lib/chespirito/routes/route_utils.rb', line 6 def words(path) = path.split("/").delete_if(&:empty?) |