latias-date-format 0.1.2 → 0.1.7

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: e35276d9a5e2e32b4a794f451e8fc62ec20662bcab819b77b4733821bdb1b2d2
4
- data.tar.gz: b182f198776e132925b1a62e7a636dc33a710343f30bdf6ba185e9bc8bdcbcc0
3
+ metadata.gz: 3ca7372c40ccda674af94b029713832347875ff8e1593258736919d396e2b8cb
4
+ data.tar.gz: 4925ae99610072c7cd1a55cf5f70666298be3004fa7b6431e9daf1d104f700f2
5
5
  SHA512:
6
- metadata.gz: 4e744cf08e2e7d8a8a68bf9c76227c342af387bf4bf540ee29c01759d3e14aa486c7b5ca593d891bd2cd5b72ded82f4ec18ae9e1d952b3d1c062a8fccb854b9b
7
- data.tar.gz: 248a087b218b9e2a3a7b9419f895c87b73a0e9fa5da2f62ef0dfdc165411e0dad9704d2ac9b3e43366d57409f6bd66ae3cf608fda9be9933604f4ec011b64677
6
+ metadata.gz: c3b567559a2e1e0c9c04a37927298360b5e7822617bbb4468000dd71627a8c3777cc0c4dff84301f4a31d231ffec8543832edb080b728f2c586921650fafb65b
7
+ data.tar.gz: cb57d483061e6ee788ef5cd190ece7262280c37cd1f92ac4024846c901476760839769a40f3b8064bf83b93595ff314aa349bc3cc61ae4ffb8e73fae6b56c7ce
data/README.md CHANGED
@@ -1,19 +1,29 @@
1
+ <!--
2
+ how to update
3
+ gem build latias-date-format.gemspec
4
+ gem push latias-date-format-0.1.6.gem
5
+ -->
6
+
1
7
  # Latias::Date::Format
8
+
2
9
  Short description and motivation.
3
10
 
4
11
  ## Usage
12
+
5
13
  How to use my plugin.
6
14
 
7
15
  ## Installation
16
+
8
17
  Add this line to your application's Gemfile:
9
18
 
10
19
  ```ruby
11
- gem 'latias-date-format', '~> 0.1.2'
20
+ gem 'latias-date-format', '~> 0.1'
12
21
  # or
13
- gem 'latias-date-format', git: 'https://nattanon:dT1Lcvf8pvGoU7LX4Uqr@gitlab.opensource-technology.com/nattanon/latias-date-format-rails.git'
22
+ gem 'latias-date-format', '~> 0.1', git: 'https://nattanon:dT1Lcvf8pvGoU7LX4Uqr@gitlab.opensource-technology.com/nattanon/latias-date-format-rails.git'
14
23
  ```
15
24
 
16
25
  ## Examples
26
+
17
27
  ```ruby
18
28
  2.6.5 :001 > buddist_date_format(Date.today) # Date
19
29
  => "15 มกราคม 2564"
@@ -27,8 +37,16 @@ gem 'latias-date-format', git: 'https://nattanon:dT1Lcvf8pvGoU7LX4Uqr@gitlab.ope
27
37
  => "ม.ค. 2564 17:20:23 +0700"
28
38
  ```
29
39
 
40
+ ### Manual
41
+
42
+ ```ruby
43
+ include Latias::Date::Formater
44
+ ```
45
+
30
46
  ## Contributing
47
+
31
48
  Contribution directions go here.
32
49
 
33
50
  ## License
51
+
34
52
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -27,4 +27,6 @@ th:
27
27
  - กันยายน
28
28
  - ตุลาคม
29
29
  - พฤศจิกายน
30
- - ธันวาคม
30
+ - ธันวาคม
31
+ day_names: [อาทิตย์, จันทร์, อังคาร, พุธ, พฤหัสบดี, ศุกร์, เสาร์]
32
+ abbr_day_names: [อา., จ., อ., พ., พฤ., ศ., ส.]
@@ -3,17 +3,6 @@ require 'latias/date/format/engine'
3
3
  module Latias
4
4
  module Date
5
5
  module Format
6
- def buddist_date_format(date, format: '%e %B %Y')
7
- format = format.gsub('%Y', buddhist_year(date.year).to_s)
8
- format = format.gsub('%y', (buddhist_year(date.year) % 100).to_s)
9
- I18n.l(date, format: format, locale: :th)
10
- end
11
-
12
- def buddhist_year(year)
13
- year + 543
14
- end
15
6
  end
16
7
  end
17
8
  end
18
-
19
- extend Latias::Date::Format
@@ -1,10 +1,14 @@
1
+ require 'latias/date/formater'
2
+
1
3
  module Latias
2
4
  module Date
3
5
  module Format
4
6
  class Engine < ::Rails::Engine
5
7
  isolate_namespace Latias::Date::Format
6
- initializer 'application_helper' do
7
- ActionView::Base.include Latias::Date::Format
8
+ # ActionController::Base.include Latias::Date::Format
9
+ ActionView::Base.include Latias::Date::Formater
10
+ ActiveSupport.on_load(:action_controller_base) do
11
+ include Latias::Date::Formater
8
12
  end
9
13
  end
10
14
  end
@@ -1,7 +1,7 @@
1
1
  module Latias
2
2
  module Date
3
3
  module Format
4
- VERSION = '0.1.2'.freeze
4
+ VERSION = '0.1.7'.freeze
5
5
  end
6
6
  end
7
7
  end
@@ -0,0 +1,17 @@
1
+ module Latias
2
+ module Date
3
+ module Formater
4
+ def buddist_date_format(date, format: '%e %B %Y')
5
+ format = format.gsub('%Y', buddhist_year(date.year).to_s)
6
+ format = format.gsub('%y', (buddhist_year(date.year) % 100).to_s)
7
+ I18n.l(date, format: format, locale: :th)
8
+ end
9
+
10
+ def buddhist_year(year)
11
+ year + 543
12
+ end
13
+ end
14
+ end
15
+ end
16
+
17
+ # extend Latias::Date::Format
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: latias-date-format
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - nattanon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-02 00:00:00.000000000 Z
11
+ date: 2021-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -47,6 +47,7 @@ files:
47
47
  - lib/latias/date/format.rb
48
48
  - lib/latias/date/format/engine.rb
49
49
  - lib/latias/date/format/version.rb
50
+ - lib/latias/date/formater.rb
50
51
  - lib/tasks/latias/date/format_tasks.rake
51
52
  homepage: https://gitlab.opensource-technology.com/nattanon/latias-date-format-rails
52
53
  licenses: