stipa 0.1.5 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cae685e56a311306ac9de5e6590a97811aeb1037c37c16c8fc1678414853df71
4
- data.tar.gz: f5fe15523b603ec40905a278e78790b963498ee0aef45b3d431a16723a63493e
3
+ metadata.gz: 4e71cdd27e54722ed384abca34ca3478d671839ccf026abc8f42378791b1b20a
4
+ data.tar.gz: 1ba6eb20c650ab6a2f092334c6831a6d4ea4bcbf0c92305b85ebebcd483add53
5
5
  SHA512:
6
- metadata.gz: 4eb79042d8771b8384f37191f0aa99ee5fc63a82b62fc0201be0d074b460c4d066484d6710b5fc659ec6ec0dd6a6be1d21bee6a97035f88155d3ff38a92f94bc
7
- data.tar.gz: 3db21d82f8e03e20d343fb65092f12bf5f92034dac1eb15289e702c1f23ca62e18e28d4222f091839b33903df077ad18454e9c4674d36374408224b2631ca6e7
6
+ metadata.gz: c8452941f67b0cfdda3345059dc0da6d21d5ef50275028d633da2bcdd0c80cf37ff159a0516b11e2737470f1758e37ba7b83be9ff78707340e2bedff2b3e2494
7
+ data.tar.gz: 1f16b15656290daa904eefaf5953353d5874de701b529831b40d00111c49d2cf88f294b8e1be061806657c502030e333e056283f477118d772b9d444c6f40ca9
data/CHANGELOG.md CHANGED
@@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.1.6] - 2026-03-20
9
+
10
+ ### Added
11
+
12
+ - **Colon-segment route patterns** — string routes now accept `:param` placeholders
13
+ (e.g. `'/users/:id'`, `'/admin/users/:id'`). Segments are converted to anchored
14
+ named-capture Regexps at match time; captured values are available via `req.params`.
15
+ - **Namespaced controller resolution** — `to:` values such as `'admin/users#update'`
16
+ are now resolved to `Admin::UsersController#update`. Slash separators become `::` and
17
+ each segment is camel-cased independently (snake_case preserved).
18
+
8
19
  ## [0.1.5] - 2026-03-20
9
20
 
10
21
  ### Added
data/lib/stipa/app.rb CHANGED
@@ -95,8 +95,14 @@ module Stipa
95
95
 
96
96
  match = case pattern
97
97
  when String
98
- # Exact string match
99
- req.path == pattern ? true : nil
98
+ if pattern.include?(':')
99
+ # Colon-segment pattern: /users/:id named-capture Regexp
100
+ re = pattern.gsub(%r{:([a-zA-Z_][a-zA-Z0-9_]*)}) { "(?<#{Regexp.last_match(1)}>[^/]+)" }
101
+ Regexp.new("\\A#{re}\\z").match(req.path)
102
+ else
103
+ # Exact string match
104
+ req.path == pattern ? true : nil
105
+ end
100
106
  when Regexp
101
107
  # Full Regexp match — named captures become req.params
102
108
  pattern.match(req.path)
@@ -132,7 +132,10 @@ module Stipa
132
132
 
133
133
  def resolve(to)
134
134
  ctrl, action = to.split('#', 2)
135
- klass = Object.const_get(ctrl.split('_').map(&:capitalize).join + 'Controller')
135
+ # 'admin/users' 'Admin::UsersController'
136
+ # 'users' → 'UsersController'
137
+ class_name = ctrl.split('/').map { |seg| seg.split('_').map(&:capitalize).join }.join('::') + 'Controller'
138
+ klass = Object.const_get(class_name)
136
139
  [klass, action.to_sym]
137
140
  end
138
141
 
data/lib/stipa/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Stipa
2
- VERSION = '0.1.5'
2
+ VERSION = '0.1.6'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stipa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pedro Harbs