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 +4 -4
- data/app/views/rails-diff-time/_diff_time.html.erb +6 -4
- data/lib/rails/diff/time/engine.rb +17 -0
- data/lib/rails/diff/time/version.rb +1 -1
- data/lib/rails/diff/time.rb +1 -17
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0df096d6ed881a33af5f513b00298f22b6e689d95b0f473682941e8d6eadc8a5
|
|
4
|
+
data.tar.gz: e325fa3d700ef58840ca6eaca3bd0c5148aaf4c809136ca4693b174966ed9829
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 556b016fb84ba4f42836b2cbe46db4691e50b96665a125314791e8aff55e7df0abfb3f30a1fbeca6aeb972c890672a750a376b2473571b43527de64b9f080100
|
|
7
|
+
data.tar.gz: a3c3921bf4231dcccd71a0979b7aff25bcefbf9f845906cb4b724e23f677ddec18496ca2c72250a1af62616a3104175fce2e0b847bfa965f41b88be299c6862c
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
<%
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
_element_name ||= locals[:element_name] || "span"
|
|
3
|
+
_diff_time = locals[:diff_time]
|
|
4
|
+
_attributes ||= locals[:attributes] || {}
|
|
5
5
|
%>
|
|
6
|
-
|
|
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
|
data/lib/rails/diff/time.rb
CHANGED
|
@@ -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.
|
|
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
|