tzispa_helpers 0.3.5 → 0.3.6

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: 0102c92ceaff055b26a8547b791bc900c9e1a5b8
4
- data.tar.gz: 28341d8615fbaa60ed0d180a805ec032f2d4614e
3
+ metadata.gz: 1d48b8fbafce2025bc196d9fe9602913277d90b4
4
+ data.tar.gz: 635ea2e314e571be2780e68eaeccb7a900146c7c
5
5
  SHA512:
6
- metadata.gz: c26223806ffd4b4600ed41e19dbb27d452290ff38ea0fc3e91d18fa7aa9283ed7a402ae6d7d4569b1d0117fb215c7e8b446c7152dedc6969d85d7be1c166281b
7
- data.tar.gz: cd4aa19893ccf96fe2a87fbb6a1fb0103a915ae1d33523b4ee0f7f672b99a761f8a4aa5ee6f6fb596a590b76b54e33f12cc4a52a2a6e3463584d519a98d08d60
6
+ metadata.gz: 071d4209a4b2efacc527bc8f05e8c63185e49eab9bb9cfaa9579c124adbcbfe474304b6764e3aa910c8aab69e9cb390eb43f002e3357471d595927ce59a72bd9
7
+ data.tar.gz: 415c15efef524ad0ddd60f7597515092754de4017d4266e04255ec9aec63d6465954c4d44df3373ee0b4d65fd00968d3c9a663636064e48e9e9dacf069b8731d
@@ -1,5 +1,8 @@
1
1
  Tzispa Helpers
2
2
 
3
+ ## v0.3.6
4
+ - constants autoloading
5
+
3
6
  ## v0.3.4
4
7
  - added macro_field helper
5
8
  - added user login related helper module
@@ -3,18 +3,23 @@
3
3
  module Tzispa
4
4
  module Helpers
5
5
 
6
- require 'tzispa/helpers/date_time'
7
- require 'tzispa/helpers/error_view'
8
- require 'tzispa/helpers/html'
9
- require 'tzispa/helpers/pattern'
10
- require 'tzispa/helpers/provider'
11
- require 'tzispa/helpers/request'
12
- require 'tzispa/helpers/requirer'
13
- require 'tzispa/helpers/response'
14
- require 'tzispa/helpers/security'
15
- require 'tzispa/helpers/sign_requirer'
16
- require 'tzispa/helpers/text'
17
- require 'tzispa/helpers/version'
6
+ autoload :DateTime, 'tzispa/helpers/date_time'
7
+ autoload :ErrorView, 'tzispa/helpers/error_view'
8
+ autoload :Hooks, 'tzispa/helpers/hooks'
9
+ autoload :Html, 'tzispa/helpers/html'
10
+ autoload :MacroField, 'tzispa/helpers/macro_field'
11
+ autoload :Mime, 'tzispa/helpers/mime'
12
+ autoload :Pattern, 'tzispa/helpers/pattern'
13
+ autoload :Provider, 'tzispa/helpers/provider'
14
+ autoload :Request, 'tzispa/helpers/request'
15
+ autoload :Requirer, 'tzispa/helpers/requirer'
16
+ autoload :Response, 'tzispa/helpers/response'
17
+ autoload :Security, 'tzispa/helpers/security'
18
+ autoload :SessionAuth, 'tzispa/helpers/session_auth'
19
+ autoload :SessionFlashBag, 'tzispa/helpers/session_flash_bag'
20
+ autoload :Session, 'tzispa/helpers/session'
21
+ autoload :SignRequirer, 'tzispa/helpers/sign_requirer'
22
+ autoload :Text, 'tzispa/helpers/text'
18
23
 
19
24
  end
20
25
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'tzispa/rig/template'
4
4
  require 'tzispa/version'
5
- require 'tzispa/helpers/services/error_view'
5
+ require_relative 'services/error_view'
6
6
 
7
7
  module Tzispa
8
8
  module Helpers
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Tzispa
4
+ module Helpers
5
+ module Hooks
6
+
7
+ autoload :After, 'tzispa/helpers/hooks/after'
8
+ autoload :Before, 'tzispa/helpers/hooks/before'
9
+
10
+ end
11
+ end
12
+ end
@@ -14,9 +14,7 @@ module Tzispa
14
14
  def process_macros(source, fields, data_object: nil, json: nil)
15
15
  (data_object || {}).tap do |data|
16
16
  fields.each do |name|
17
- macro_field = name.split('@:')
18
- macro = macro_field.first.to_sym if macro_field.length == 2
19
- field = macro_field.length == 2 ? macro_field.last : macro_field.first
17
+ macro, field = split_macro_field(name)
20
18
  build_field source, field, macro, data
21
19
  end
22
20
  json&.each do |key, value|
@@ -25,6 +23,15 @@ module Tzispa
25
23
  end
26
24
  end
27
25
 
26
+ def split_macro_field(name)
27
+ macro_field = name.split('@:')
28
+ if macro_field.length == 2
29
+ [macro_field.first.to_sym, macro_field.last]
30
+ else
31
+ [nil, macro_field.first]
32
+ end
33
+ end
34
+
28
35
  def build_field(source, field, macro, data)
29
36
  field.split(':').tap do |orig, dest|
30
37
  dest ||= orig
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'securerandom'
4
- require 'tzispa/helpers/session_flash_bag'
4
+ require_relative 'session_flash_bag'
5
5
 
6
6
  module Tzispa
7
7
  module Helpers
@@ -39,7 +39,6 @@ module Tzispa
39
39
  ident = context.session[SESSION_AUTH_USER]
40
40
  ident.id if session_auth?
41
41
  end
42
- alias session_login session_auth
43
42
 
44
43
  def session_login(user)
45
44
  context.session[SESSION_AUTH_USER] = Authentication.new(user, context.session.id)
@@ -3,7 +3,7 @@
3
3
  module Tzispa
4
4
  module Helpers
5
5
 
6
- VERSION = '0.3.5'
6
+ VERSION = '0.3.6'
7
7
  NAME = 'Tzispa Helpers'
8
8
  GEM_NAME = 'tzispa_helpers'
9
9
 
@@ -1,7 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Tzispa
2
4
  module Helpers
3
5
 
6
+ require 'tzispa/helpers/version'
4
7
  require 'tzispa/helpers'
5
-
8
+
6
9
  end
7
10
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tzispa_helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.6
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: 2017-10-14 00:00:00.000000000 Z
11
+ date: 2017-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
@@ -64,6 +64,7 @@ files:
64
64
  - lib/tzispa/helpers.rb
65
65
  - lib/tzispa/helpers/date_time.rb
66
66
  - lib/tzispa/helpers/error_view.rb
67
+ - lib/tzispa/helpers/hooks.rb
67
68
  - lib/tzispa/helpers/hooks/after.rb
68
69
  - lib/tzispa/helpers/hooks/before.rb
69
70
  - lib/tzispa/helpers/html.rb
@@ -105,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
105
106
  version: '0'
106
107
  requirements: []
107
108
  rubyforge_project:
108
- rubygems_version: 2.6.13
109
+ rubygems_version: 2.6.14
109
110
  signing_key:
110
111
  specification_version: 4
111
112
  summary: Helpers for Tzispa