wiser_timezone 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZWY0ZDI0OTA5NjY2NmFkMGQ1NTVjZDIxODFjZmI4ZjMxMmIyOGI3OA==
4
+ ZmE5ZGEzMDYyNmJkMzAzNzBmMTE5MTM1YWI3NzAwNzM4YjJkNmMxMQ==
5
5
  data.tar.gz: !binary |-
6
- MTg1ZGJkOTAzNGZiNTA5MGQxYjY1NDIwZGJlZjlhZWZkNTE0NjczZA==
6
+ NzQ3YmM2MmFkY2NiNzgzNWJjY2ExNDZlYjMyMDBiY2FjZWIxNWQwMA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ZGMwYzNkMDhkZTkxYzc1ZWUwOGIzMWNiMDU0MzExYjM2MWZiYmRmNzhlY2I3
10
- NWJkZDhmYTlkZjQyNmMwNWIyNDgwNjZhMGUwMjkwMTU2ZjdiODkxZTQwOWVi
11
- NDdlODRhMGY0NDEwN2U3YTU2MjgwYmUzNDkxZTQ5OTUzZGUxZjg=
9
+ N2JhZWMxZjQ5NzEyMjI4NWJjZTBiMzUzMTE4YzIxMzdhZDEzNjE0OWVjMDk0
10
+ MjdhMDAwMzczZTEwYTFhZDMzMmE0OGI2MjBhZGJjZjhkODRjOTQ2MTA0NDFm
11
+ MTJkODc0OTdlOGEyNjk5OWE2NjUxMzAzZjBhM2RhMDQ3NGIyOTI=
12
12
  data.tar.gz: !binary |-
13
- NWRjOGQ1YWNkMDBhOTMyMDRlN2MzNjU3OWM0MDkwODNkZTRlN2VhOWU4YmEy
14
- YzFmN2RjNzUzZmIwMzY0NjE5MTIwYTNjYTcxODgxODI3NjQyZjcxNTI5YTUw
15
- NjZmMTc4ODc3MmJlN2YwODkyYmQzZDU1YzY1YmQwNzQ0NmY0MmU=
13
+ MmEwYjZhOWFkMjk0YjQ1ZDY1YzQ5ZDA1NDllMzkxNWE1ODkyNWI1YjFkYTMy
14
+ NjU4ZmRmZWNmZGUwNmIxZTFlNTU5MjViZjUxZTM2M2E4MmE3NWU0ZjkzMDcx
15
+ YjY2MmFjMzFjMjUwYTE0MDEyNDA0OWI2ZDg5ZGY1NTVjMjVjODE=
data/README.md CHANGED
@@ -16,7 +16,7 @@ You can do normal gem installation for `wiser_timezone` from your terminal:
16
16
 
17
17
  or add this line in your Gemfile:
18
18
 
19
- gem 'wiser_timezone', '~> 0.1.1'
19
+ gem 'wiser_timezone', '~> 0.1.2'
20
20
 
21
21
  Be sure to restart your application if it is already running.
22
22
 
@@ -73,7 +73,7 @@ Render the `wiser_timezone_initialize` view below the `body` of your layout file
73
73
 
74
74
  All dates must be printed using the custom helper `wiser_timezone()` from the `wiser_timezone`.
75
75
 
76
- ### Examples
76
+ ### Basic Examples
77
77
 
78
78
  You can do the normal usage:
79
79
 
@@ -85,15 +85,17 @@ Or even format the value:
85
85
  <%= wiser_timezone(@post.created_at).strftime('%Y-%m-%d %H:%M:%S') %>
86
86
  // Return: 2014-03-15 02:37:07
87
87
 
88
- ### Expand
88
+ ### Globalize
89
89
 
90
- You can use the *WiserTimezone* helpers in your controller, just include the library in your `ApplicationController`:
90
+ Enable the *WiserTimezone* in the entire application by adding the `ensure_timezone` method as a `before_filter` of your `ApplicationController`:
91
91
 
92
92
  include WiserTimezone::WiserTimezoneHelper
93
93
  class ApplicationController < ActionController::Base
94
+ before_filter :ensure_timezone
94
95
  # More Codes
95
96
  end
96
97
 
98
+
97
99
  ### Extra
98
100
 
99
101
  You can get the current timezone using the `current_timezone` method:
@@ -1,6 +1,10 @@
1
1
  module WiserTimezone
2
2
  module WiserTimezoneHelper
3
3
 
4
+ def ensure_timezone
5
+ Time.zone = current_timezone
6
+ end
7
+
4
8
  def current_timezone
5
9
  return ActiveSupport::TimeZone[offset.to_i]
6
10
  end
@@ -1,3 +1,3 @@
1
1
  module WiserTimezone
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wiser_timezone
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kenneth John Balgos
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-24 00:00:00.000000000 Z
11
+ date: 2014-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler