tzispa_rig 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 85460707b768aacfda498419acc54745d5c16023
4
- data.tar.gz: fed21c4359870abf3c347166777b6cf6fe63693d
3
+ metadata.gz: 4cd09f61d15166b4d143e917b9aa1d28957685b4
4
+ data.tar.gz: 17264385d89f93c1ff1cd3b387ca5499a352545c
5
5
  SHA512:
6
- metadata.gz: b7f6c00dbab72e985feb68dc402f1b37d8af52f2893380d224a758125ab5e955ff9c11e0d17259c883af1a811042a4d09da2dce90e7c59a700648fa7704b2b50
7
- data.tar.gz: 9851c3d85331cb4436faeeae19dd603fe8e2dfe05dfc940d84af88abac60142ba28eb8974bf48798533b36aafa2fd553df68740e9dbd345d3c7845d594172ca6
6
+ metadata.gz: 5b4e9b77f6e96c2b746fad05846b1f235a47682bb3d3e65c2c6fce7c873a07409627b3e07bd370f8ef6f0a49bdf4f4d35a9e1dbef2c7bfab5468dbe7b1abacee
7
+ data.tar.gz: b4ee7c671154e99818d103334cec470526a11cc0e06e8b98aed5378ca5b61bc654c15e348ec0504684f2cdc868ce78f54ca51ec422a55252af0d697bc4932a42
data/CHANGELOG.md CHANGED
@@ -2,6 +2,9 @@ Tzispa Rig
2
2
 
3
3
  Rig templates implementation
4
4
 
5
+ ## v0.4.2
6
+ - add support for metavars in purl/url tag id
7
+
5
8
  ## v0.4.1
6
9
  - add inter-app calls for url and api tags
7
10
 
@@ -103,11 +103,11 @@ module Tzispa
103
103
 
104
104
  class ParsedUrl < ParsedEntity
105
105
 
106
- attr_reader :path_id, :params, :app_name
106
+ attr_reader :layout, :params, :app_name
107
107
 
108
- def initialize(parser, type, path_id, params, app_name = nil)
108
+ def initialize(parser, type, layout, params, app_name = nil)
109
109
  super(parser, type)
110
- @path_id = path_id.to_sym
110
+ @layout = layout
111
111
  @params = params
112
112
  @app_name = app_name
113
113
  end
@@ -116,18 +116,26 @@ module Tzispa
116
116
  b_params = @params.dup.gsub(RE_ANCHOR) { |match|
117
117
  parser.the_parsed.select { |p| p.anchor == match}.first.render(binder)
118
118
  } if @params
119
+ b_layout = bind_value(@layout.dup, binder).to_sym
119
120
  case type
120
121
  when :purl
121
122
  app_name ?
122
- binder.context.app_path(app_name, @path_id, Parameters.new(b_params).tp_h) :
123
- binder.context.path(@path_id, Parameters.new(b_params).to_h)
123
+ binder.context.app_layout_path(app_name, b_layout, Parameters.new(b_params).tp_h) :
124
+ binder.context.layout_path(b_layout, Parameters.new(b_params).to_h)
124
125
  when :url
125
126
  app_name ?
126
- binder.context.app_canonical_url(app_name, @path_id, Parameters.new(b_params).to_h) :
127
- binder.context.canonical_url(@path_id, Parameters.new(b_params).to_h)
127
+ binder.context.app_layout_canonical_url(app_name, b_layout, Parameters.new(b_params).to_h) :
128
+ binder.context.layout_canonical_url(b_layout, Parameters.new(b_params).to_h)
128
129
  end
129
130
  end
130
131
 
132
+ def bind_value(value, binder)
133
+ value.gsub(RE_ANCHOR) { |match|
134
+ parser.the_parsed.select { |p| p.anchor == match}.first.render(binder)
135
+ }
136
+ end
137
+
138
+
131
139
  end
132
140
 
133
141
 
@@ -12,7 +12,7 @@ module Tzispa
12
12
  }.freeze
13
13
 
14
14
  RIG_URL_BUILDER = {
15
- :url => /<(url|purl)(@\w+)?:(\w+(?:\.\w+)?)(\[(\w+=[^,\]]+(,\w+=[^,\]]+)*?)\])?\/>/,
15
+ :url => /<(url|purl)(@\w+)?:([^\[\.\/]+(?:\.[^\[\/]+)?)(\[(\w+=[^,\]]+(,\w+=[^,\]]+)*?)\])?\/>/,
16
16
  :api => /<(api|sapi)(@\w+)?:([^:\.]+(?:\.[^:]+)?):([^:\/]+)(?::([^:\/]+))?(?::([^\/]+))?\/>/
17
17
  }.freeze
18
18
 
@@ -3,7 +3,7 @@
3
3
  module Tzispa
4
4
  module Rig
5
5
 
6
- VERSION = '0.4.1'
6
+ VERSION = '0.4.2'
7
7
  GEM_NAME = 'tzispa_rig'
8
8
 
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tzispa_rig
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Antonio Piñero
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-13 00:00:00.000000000 Z
11
+ date: 2016-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tzispa_helpers