lazier 3.5.5 → 3.5.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -103,9 +103,9 @@
103
103
  </div>
104
104
 
105
105
  <div id="footer">
106
- Generated on Sun May 11 14:35:06 2014 by
106
+ Generated on Thu Jun 19 11:34:23 2014 by
107
107
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
108
- 0.8.7.4 (ruby-2.1.0).
108
+ 0.8.7.4 (ruby-2.1.2).
109
109
  </div>
110
110
 
111
111
  </body>
@@ -164,17 +164,28 @@ module Lazier
164
164
  #
165
165
  # @return [String] The current alias or the first alias of the current timezone.
166
166
  def current_alias
167
- identifier = tzinfo.identifier
167
+ if @current_alias
168
+ @current_alias
169
+ else
170
+ identifier = tzinfo.identifier
168
171
 
169
- catch(:alias) do
170
- aliases.each do |a|
171
- throw(:alias, a) if a == identifier
172
- end
172
+ catch(:alias) do
173
+ aliases.each do |a|
174
+ throw(:alias, a) if a == identifier
175
+ end
173
176
 
174
- aliases.first
177
+ aliases.first
178
+ end
175
179
  end
176
180
  end
177
181
 
182
+ # Sets the current alias.
183
+ #
184
+ # @param new_alias [String] The new current alias.
185
+ def current_alias=(new_alias)
186
+ @current_alias = new_alias.ensure_string
187
+ end
188
+
178
189
  # Returns the standard offset for this timezone.
179
190
  #
180
191
  # @param rational [Boolean] If to return the offset as a Rational.
@@ -16,7 +16,7 @@ module Lazier
16
16
  MINOR = 5
17
17
 
18
18
  # The patch version.
19
- PATCH = 5
19
+ PATCH = 6
20
20
 
21
21
  # The current version of lazier.
22
22
  STRING = [MAJOR, MINOR, PATCH].compact.join(".")
@@ -89,6 +89,14 @@ describe Lazier::TimeZone do
89
89
  end
90
90
  end
91
91
 
92
+ describe "#current_alias=" do
93
+ it "should set the current alias alias" do
94
+ zone = ActiveSupport::TimeZone["America/Halifax"]
95
+ zone.current_alias = "ALIAS"
96
+ expect(zone.current_alias).to eq("ALIAS")
97
+ end
98
+ end
99
+
92
100
  describe "#dst_period" do
93
101
  it "should correctly return zone offset" do
94
102
  expect(subject_zone.dst_period).to be_a(::TZInfo::TimezonePeriod)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lazier
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.5.5
4
+ version: 3.5.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shogun
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-11 00:00:00.000000000 Z
11
+ date: 2014-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json