rails-diff-time 0.1.1 → 0.1.3

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: 65cee7df148dc1caa2c86420addbca3100ac936f1e18721f5ef3ff5ffe41df84
4
- data.tar.gz: cfbdc435f4190573f5a9635752a1922806dd0dcb5cd232b38656f1dd759fd8c1
3
+ metadata.gz: 0df096d6ed881a33af5f513b00298f22b6e689d95b0f473682941e8d6eadc8a5
4
+ data.tar.gz: e325fa3d700ef58840ca6eaca3bd0c5148aaf4c809136ca4693b174966ed9829
5
5
  SHA512:
6
- metadata.gz: de655e4b6f83063fc679a431ee8e93ce2d6879971deac3794025818cc49d78dfe1f05e95aa3920f031ab20e1ce7c210f3e174acaf2aee721cb421f26c76d3b9d
7
- data.tar.gz: 2a04d12b91f7f6ab095e9de93dd0f94326387f1860b4ef52dd3a166d2434382421a469b914d718bb39f7b8bf15c6c3e09404e08c24a26362fc48b5872bdadaf1
6
+ metadata.gz: 556b016fb84ba4f42836b2cbe46db4691e50b96665a125314791e8aff55e7df0abfb3f30a1fbeca6aeb972c890672a750a376b2473571b43527de64b9f080100
7
+ data.tar.gz: a3c3921bf4231dcccd71a0979b7aff25bcefbf9f845906cb4b724e23f677ddec18496ca2c72250a1af62616a3104175fce2e0b847bfa965f41b88be299c6862c
@@ -1,6 +1,8 @@
1
1
  <%
2
- element_name ||= locals[:element_name] || "span"
3
- diff_time = locals[:diff_time]
4
- attributes ||= locals[:attributes] || {}
2
+ _element_name ||= locals[:element_name] || "span"
3
+ _diff_time = locals[:diff_time]
4
+ _attributes ||= locals[:attributes] || {}
5
5
  %>
6
- <%= content_tag(element_name.to_sym, diff_time, attributes) %>
6
+ <% if _diff_time %>
7
+ <%= content_tag(_element_name.to_sym, _diff_time, _attributes) %>
8
+ <% end %>
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RailsDiffTime
4
+ # Rails engine for integrating RailsDiffTime into Rails applications.
5
+ #
6
+ # This engine automatically includes the time difference helpers into
7
+ # ActionView, making them available in all views and templates.
8
+ class Engine < ::Rails::Engine
9
+ isolate_namespace RailsDiffTime
10
+
11
+ initializer "rails_diff_time.helpers" do
12
+ ActiveSupport.on_load(:action_view) do
13
+ include RailsDiffTime::Helpers
14
+ end
15
+ end
16
+ end
17
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsDiffTime
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.3"
5
5
  end
@@ -2,24 +2,8 @@
2
2
 
3
3
  require_relative "time/version"
4
4
  require_relative "time/helpers"
5
+ require_relative "time/engine" if defined?(Rails)
5
6
 
6
7
  module RailsDiffTime
7
8
  class Error < StandardError; end
8
-
9
- # Define Engine class only when Rails::Engine is available
10
- if defined?(::Rails::Engine)
11
- # Rails engine for integrating RailsDiffTime into Rails applications.
12
- #
13
- # This engine automatically includes the time difference helpers into
14
- # ActionView, making them available in all views and templates.
15
- class Engine < ::Rails::Engine
16
- isolate_namespace RailsDiffTime
17
-
18
- initializer "rails_diff_time.helpers" do
19
- ActiveSupport.on_load(:action_view) do
20
- include RailsDiffTime::Helpers
21
- end
22
- end
23
- end
24
- end
25
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-diff-time
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - dhq_boiler
@@ -26,6 +26,7 @@ files:
26
26
  - Rakefile
27
27
  - app/views/rails-diff-time/_diff_time.html.erb
28
28
  - lib/rails/diff/time.rb
29
+ - lib/rails/diff/time/engine.rb
29
30
  - lib/rails/diff/time/helpers.rb
30
31
  - lib/rails/diff/time/version.rb
31
32
  - sig/rails/diff/time.rbs