halbuilder 0.1.0 → 0.1.1

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
  SHA256:
3
- metadata.gz: 8aef0833d5b98f1f2be71e2734b74f2ac39e9a403bdaacd698759fc99a59ba68
4
- data.tar.gz: d49275d798a0a73ffb68ca951ec045490e5b0d491f9e3ef86ac4c3aceb5f30cb
3
+ metadata.gz: acc87ca010b4e3f4b0da059bb27c9fc8c14f7999ebda8137d3e29f8209397e55
4
+ data.tar.gz: 9eaccc140d922baa09ddb68d0f362fcd4ac4af9cc7b95aa6deefa7a5d55a4e42
5
5
  SHA512:
6
- metadata.gz: c470bcb51e9e4c1fea988533afdf86273dc8f1ddab377809e0e402ebb385289f755887098f3adae717f472dd039d937b309afcbb3dfc4f3b1eb9866cbe1e2a02
7
- data.tar.gz: 7ff41ec9985d74868b82c3a7b027d75856df927ea94ea449d3aad0477238d2746fc021f98a0e8cb88ccc381bbb97d51ca116e49c63c1c9594d41661e32d5193c
6
+ metadata.gz: bbfd8508512a6870abfa9435bb5572dba2c5cb6852879e793574615781b81926a27dc7cd5cc97e437da1cc80fc3c06b7345748e5d3c84cb6c95fbab741874452
7
+ data.tar.gz: 7f826e86a3bfe49b4e629596c160c2593d457e96ec5880a650b95e35383b0fd383daf4e42f85329bdc66df3eedc814be3eec2a76197ce17f798a16038547b4c3
data/CHANGELOG.md CHANGED
@@ -1,4 +1,8 @@
1
- ## [Unreleased]
1
+ ## [0.1.1] - 2022-07-21
2
+
3
+ - Add `Halbuilder::Helper` module, automatically included in Rails views/controllers.
4
+ Currently only has a `hal_zoomed?` method to help decide when to preload associations.
5
+ - `Jbuilder.ignore_nil(true)` by default
2
6
 
3
7
  ## [0.1.0] - 2022-07-20
4
8
 
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "./zoom"
4
+
5
+ module Halbuilder::Helper
6
+ include Halbuilder::Zoom
7
+
8
+ def zoom_param
9
+ params[:zoom]
10
+ end
11
+ end
@@ -4,6 +4,7 @@ module Halbuilder::KeyFormat
4
4
  class << self
5
5
  def setup
6
6
  ::Jbuilder.deep_format_keys(true)
7
+ ::Jbuilder.ignore_nil(true)
7
8
 
8
9
  ::Jbuilder.key_format ->(key) do
9
10
  key_format = Halbuilder.configuration.key_format
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Halbuilder
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
@@ -4,7 +4,7 @@ module Halbuilder::Zoom
4
4
  TRUTHY = [true, "true", "TRUE", 1, "1"]
5
5
  FALSEY = [false, "false", "FALSE", 0, "0"]
6
6
 
7
- def hal_zoomed?(rel, default_setting)
7
+ def hal_zoomed?(rel, default_setting = false)
8
8
  if default_setting.nil?
9
9
  true
10
10
  elsif zoom_param.nil?
data/lib/halbuilder.rb CHANGED
@@ -3,6 +3,7 @@
3
3
  require "jbuilder"
4
4
  require_relative "halbuilder/configuration"
5
5
  require_relative "halbuilder/embed"
6
+ require_relative "halbuilder/helper"
6
7
  require_relative "halbuilder/key_format"
7
8
  require_relative "halbuilder/link"
8
9
  require_relative "halbuilder/paginate"
@@ -37,3 +38,11 @@ Jbuilder.include Halbuilder::Embed
37
38
  Jbuilder.include Halbuilder::Link
38
39
  Jbuilder.include Halbuilder::Paginate
39
40
  Jbuilder.include Halbuilder::Zoom
41
+
42
+ # optional rails helpers
43
+ if Module.const_defined?(:ActionView)
44
+ ActionView::Base.include(Halbuilder::Helper)
45
+ end
46
+ if Module.const_defined?(:ActionController)
47
+ ActionController::Base.include(Halbuilder::Helper)
48
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: halbuilder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - cavis
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-07-20 00:00:00.000000000 Z
11
+ date: 2022-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jbuilder
@@ -51,7 +51,6 @@ files:
51
51
  - CHANGELOG.md
52
52
  - CODE_OF_CONDUCT.md
53
53
  - Gemfile
54
- - Gemfile.lock
55
54
  - LICENSE.txt
56
55
  - README.md
57
56
  - Rakefile
@@ -59,6 +58,7 @@ files:
59
58
  - lib/halbuilder.rb
60
59
  - lib/halbuilder/configuration.rb
61
60
  - lib/halbuilder/embed.rb
61
+ - lib/halbuilder/helper.rb
62
62
  - lib/halbuilder/key_format.rb
63
63
  - lib/halbuilder/link.rb
64
64
  - lib/halbuilder/paginate.rb
data/Gemfile.lock DELETED
@@ -1,127 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- halbuilder (0.1.0)
5
- jbuilder (>= 2.0.0)
6
- kaminari (>= 1.0.0)
7
-
8
- GEM
9
- remote: https://rubygems.org/
10
- specs:
11
- actionview (6.1.6.1)
12
- activesupport (= 6.1.6.1)
13
- builder (~> 3.1)
14
- erubi (~> 1.4)
15
- rails-dom-testing (~> 2.0)
16
- rails-html-sanitizer (~> 1.1, >= 1.2.0)
17
- activemodel (6.1.6.1)
18
- activesupport (= 6.1.6.1)
19
- activerecord (6.1.6.1)
20
- activemodel (= 6.1.6.1)
21
- activesupport (= 6.1.6.1)
22
- activesupport (6.1.6.1)
23
- concurrent-ruby (~> 1.0, >= 1.0.2)
24
- i18n (>= 1.6, < 2)
25
- minitest (>= 5.1)
26
- tzinfo (~> 2.0)
27
- zeitwerk (~> 2.3)
28
- ast (2.4.2)
29
- builder (3.2.4)
30
- coderay (1.1.3)
31
- concurrent-ruby (1.1.10)
32
- crass (1.0.6)
33
- diff-lcs (1.5.0)
34
- erubi (1.10.0)
35
- i18n (1.12.0)
36
- concurrent-ruby (~> 1.0)
37
- jbuilder (2.11.5)
38
- actionview (>= 5.0.0)
39
- activesupport (>= 5.0.0)
40
- json (2.6.2)
41
- kaminari (1.2.2)
42
- activesupport (>= 4.1.0)
43
- kaminari-actionview (= 1.2.2)
44
- kaminari-activerecord (= 1.2.2)
45
- kaminari-core (= 1.2.2)
46
- kaminari-actionview (1.2.2)
47
- actionview
48
- kaminari-core (= 1.2.2)
49
- kaminari-activerecord (1.2.2)
50
- activerecord
51
- kaminari-core (= 1.2.2)
52
- kaminari-core (1.2.2)
53
- loofah (2.18.0)
54
- crass (~> 1.0.2)
55
- nokogiri (>= 1.5.9)
56
- method_source (1.0.0)
57
- minitest (5.16.2)
58
- nokogiri (1.13.7-arm64-darwin)
59
- racc (~> 1.4)
60
- nokogiri (1.13.7-x86_64-linux)
61
- racc (~> 1.4)
62
- parallel (1.22.1)
63
- parser (3.1.2.0)
64
- ast (~> 2.4.1)
65
- pry (0.13.1)
66
- coderay (~> 1.1)
67
- method_source (~> 1.0)
68
- racc (1.6.0)
69
- rails-dom-testing (2.0.3)
70
- activesupport (>= 4.2.0)
71
- nokogiri (>= 1.6)
72
- rails-html-sanitizer (1.4.3)
73
- loofah (~> 2.3)
74
- rainbow (3.1.1)
75
- rake (13.0.6)
76
- regexp_parser (2.5.0)
77
- rexml (3.2.5)
78
- rspec (3.11.0)
79
- rspec-core (~> 3.11.0)
80
- rspec-expectations (~> 3.11.0)
81
- rspec-mocks (~> 3.11.0)
82
- rspec-core (3.11.0)
83
- rspec-support (~> 3.11.0)
84
- rspec-expectations (3.11.0)
85
- diff-lcs (>= 1.2.0, < 2.0)
86
- rspec-support (~> 3.11.0)
87
- rspec-mocks (3.11.1)
88
- diff-lcs (>= 1.2.0, < 2.0)
89
- rspec-support (~> 3.11.0)
90
- rspec-support (3.11.0)
91
- rubocop (1.31.2)
92
- json (~> 2.3)
93
- parallel (~> 1.10)
94
- parser (>= 3.1.0.0)
95
- rainbow (>= 2.2.2, < 4.0)
96
- regexp_parser (>= 1.8, < 3.0)
97
- rexml (>= 3.2.5, < 4.0)
98
- rubocop-ast (>= 1.18.0, < 2.0)
99
- ruby-progressbar (~> 1.7)
100
- unicode-display_width (>= 1.4.0, < 3.0)
101
- rubocop-ast (1.19.1)
102
- parser (>= 3.1.1.0)
103
- rubocop-performance (1.14.3)
104
- rubocop (>= 1.7.0, < 2.0)
105
- rubocop-ast (>= 0.4.0)
106
- ruby-progressbar (1.11.0)
107
- standard (1.13.0)
108
- rubocop (= 1.31.2)
109
- rubocop-performance (= 1.14.3)
110
- tzinfo (2.0.5)
111
- concurrent-ruby (~> 1.0)
112
- unicode-display_width (2.2.0)
113
- zeitwerk (2.6.0)
114
-
115
- PLATFORMS
116
- arm64-darwin-21
117
- x86_64-linux
118
-
119
- DEPENDENCIES
120
- halbuilder!
121
- pry (~> 0.13.1)
122
- rake (~> 13.0)
123
- rspec (~> 3.0)
124
- standard (~> 1.3)
125
-
126
- BUNDLED WITH
127
- 2.3.18