lazier 2.6.7 → 2.7.0

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.
@@ -103,7 +103,7 @@
103
103
  </div>
104
104
 
105
105
  <div id="footer">
106
- Generated on Wed Feb 27 09:03:58 2013 by
106
+ Generated on Thu Feb 28 08:44:08 2013 by
107
107
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
108
108
  0.8.5.2 (ruby-1.9.3).
109
109
  </div>
@@ -13,7 +13,7 @@ module Lazier
13
13
  #
14
14
  # @return [Fixnum] `1` for `true`, `0` for `false`.
15
15
  def to_i
16
- (self == true) ? 1 : 0
16
+ self.is_a?(TrueClass) ? 1 : 0
17
17
  end
18
18
 
19
19
  # Returns the boolean itself for use in form helpers.
@@ -124,7 +124,7 @@ module Lazier
124
124
  def easter(year = nil)
125
125
  year = ::Date.today.year if !year.is_integer?
126
126
 
127
- # Compute using Anonymouse Gregorian Algorithm: http://en.wikipedia.org/wiki/Computus#Anonymous_Gregorian_algorithm
127
+ # Compute using Anonymous Gregorian Algorithm: http://en.wikipedia.org/wiki/Computus#Anonymous_Gregorian_algorithm
128
128
  data = easter_start(year)
129
129
  data = easter_part_1(data)
130
130
  data = easter_part_2(year, data)
@@ -156,7 +156,7 @@ module Lazier
156
156
 
157
157
  begin
158
158
  ::DateTime.strptime(value.ensure_string, format)
159
- rescue => e
159
+ rescue => _
160
160
  rv = false
161
161
  end
162
162
 
@@ -176,7 +176,7 @@ module Lazier
176
176
  # @param data [Fixnum] Partial variables from #easter_start.
177
177
  # @return [Array] Partial variables for #easter_part_2.
178
178
  def easter_part_1(data)
179
- a, b, c = data
179
+ _, b, c = data
180
180
  [
181
181
  b - (b / 4.0).floor - ((b - ((b + 8) / 25.0).floor + 1) / 3.0).floor,
182
182
  b % 4,
@@ -420,9 +420,6 @@ module Lazier
420
420
  # @return [Fixnum|Rational] The offset of this timezone.
421
421
  def current_offset(rational = false, date = nil)
422
422
  date ||= ::DateTime.now
423
-
424
- dst_period = self.dst_period
425
-
426
423
  rv = (self.period_for_utc(date.utc).dst? ? self.dst_offset : self.offset)
427
424
  rational ? self.class.rationalize_offset(rv) : rv
428
425
  end
@@ -456,10 +453,10 @@ module Lazier
456
453
  def dst_period(year = nil)
457
454
  year ||= ::Date.today.year
458
455
 
459
- nothern_summer = ::DateTime.civil(year, 7, 15).utc # This is a representation of a summer period in the Northern Hemisphere.
456
+ northern_summer = ::DateTime.civil(year, 7, 15).utc # This is a representation of a summer period in the Northern Hemisphere.
460
457
  southern_summer = ::DateTime.civil(year, 1, 15).utc # This is a representation of a summer period in the Northern Hemisphere.
461
458
 
462
- period = self.period_for_utc(nothern_summer)
459
+ period = self.period_for_utc(northern_summer)
463
460
  period = self.period_for_utc(southern_summer) if !period.dst?
464
461
  period.dst? ? period : nil
465
462
  end
@@ -539,23 +536,22 @@ module Lazier
539
536
  end
540
537
  end
541
538
 
542
- # Returns a parametized string representation for this zone.
539
+ # Returns a parameterized string representation for this zone.
543
540
  #
544
541
  # @param with_offset [Boolean] If to include offset into the representation.
545
542
  # @param name [String] The name to use for this zone. Defaults to the zone name.
546
- # @return [String] The parametized string representation for this zone.
543
+ # @return [String] The parameterized string representation for this zone.
547
544
  def to_str_parameterized(with_offset = true, name = nil)
548
545
  ::ActiveSupport::TimeZone.parameterize_zone(name || self.to_str, with_offset)
549
546
  end
550
547
 
551
- # Returns a parametized string representation for this zone with Daylight Saving Time (DST) active.
548
+ # Returns a parameterized string representation for this zone with Daylight Saving Time (DST) active.
552
549
  #
553
550
  # @param dst_label [String] Label for the DST indication. Defaults to `(DST)`.
554
- # @param with_offset [Boolean] If to include offset into the representation.
555
551
  # @param year [Fixnum] The year to which refer to. Defaults to the current year.
556
552
  # @param name [String] The name to use for this zone. Defaults to the zone name.
557
- # @return [String] The parametized string representation for this zone with DST or `nil`, if the timezone doesn't use DST for that year.
558
- def to_str_with_dst_parameterized(dst_label = nil, with_offset = true, year = nil, name = nil)
553
+ # @return [String] The parameterized string representation for this zone with DST or `nil`, if the timezone doesn't use DST for that year.
554
+ def to_str_with_dst_parameterized(dst_label = nil, year = nil, name = nil)
559
555
  rv = self.to_str_with_dst(dst_label, year, name)
560
556
  rv ? ::ActiveSupport::TimeZone.parameterize_zone(rv) : nil
561
557
  end
@@ -16,17 +16,13 @@ module Lazier
16
16
  # @param block [Proc] *Unused.*
17
17
  # @return [Object] The value for the key.
18
18
  def method_missing(method, *args, &block)
19
- rv = nil
20
-
21
19
  if self.has_key?(method.to_sym) then
22
- rv = self[method.to_sym]
20
+ self[method.to_sym]
23
21
  elsif self.has_key?(method.to_s) then
24
- rv = self[method.to_s]
22
+ self[method.to_s]
25
23
  else
26
- rv = ::Hash.method_missing(method, *args, &block)
24
+ ::Hash.method_missing(method, *args, &block)
27
25
  end
28
-
29
- rv
30
26
  end
31
27
 
32
28
  # This is called when the user access a member using dotted notation.
@@ -15,7 +15,7 @@ module Lazier
15
15
  # @return [String] The path where the translations are stored.
16
16
  module I18n
17
17
  attr_reader :i18n_locale
18
- attr_reader :i18_root
18
+ attr_reader :i18n_root
19
19
  attr_reader :i18n_locales_path
20
20
 
21
21
  # Setup all I18n translations.
@@ -14,20 +14,15 @@ module Lazier
14
14
  #
15
15
  # @return [String] The normalized number.
16
16
  def normalize_number
17
- rv = ""
18
-
19
- if self == true then
20
- rv = "1"
17
+ if self.is_a?(TrueClass) then
18
+ "1"
21
19
  elsif !self then
22
- rv = "0"
20
+ "0"
23
21
  else
24
- rv = self.ensure_string.strip
25
- rv = rv.split(/[\.,]/)
22
+ rv = self.ensure_string.strip.split(/[\.,]/)
26
23
  rv[-1] = "." + rv[-1] if rv.length > 1
27
- rv = rv.join("")
24
+ rv.join("")
28
25
  end
29
-
30
- rv
31
26
  end
32
27
 
33
28
  # Checks if the object is a valid number.
@@ -13,10 +13,10 @@ module Lazier
13
13
  MAJOR = 2
14
14
 
15
15
  # The minor version.
16
- MINOR = 6
16
+ MINOR = 7
17
17
 
18
18
  # The patch version.
19
- PATCH = 7
19
+ PATCH = 0
20
20
 
21
21
  # The current version of lazier.
22
22
  STRING = [MAJOR, MINOR, PATCH].compact.join(".")
@@ -349,8 +349,8 @@ describe Lazier::TimeZone do
349
349
  it "should correctly format (parameterized) zone with Daylight Saving Time" do
350
350
  expect(reference_zone.to_str_with_dst_parameterized).to eq("-0600@america-denver-dst")
351
351
  expect(reference_zone.to_str_with_dst_parameterized("Daylight Saving Time")).to eq("-0600@america-denver-daylight-saving-time")
352
- expect(reference_zone.to_str_with_dst_parameterized(nil, false, 1000)).to be_nil
353
- expect(reference_zone.to_str_with_dst_parameterized("Daylight Saving Time", true, nil, "NAME SPACE")).to eq("-0600@name-space-daylight-saving-time")
352
+ expect(reference_zone.to_str_with_dst_parameterized(nil, 1000)).to be_nil
353
+ expect(reference_zone.to_str_with_dst_parameterized("Daylight Saving Time", nil, "NAME SPACE")).to eq("-0600@name-space-daylight-saving-time")
354
354
  expect(zone_without_dst.to_str_with_dst_parameterized).to be_nil
355
355
  end
356
356
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lazier
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.7
4
+ version: 2.7.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-27 00:00:00.000000000 Z
12
+ date: 2013-02-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
@@ -171,7 +171,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
171
171
  version: '0'
172
172
  segments:
173
173
  - 0
174
- hash: -60093310208264875
174
+ hash: 1543346769697772444
175
175
  requirements: []
176
176
  rubyforge_project: lazier
177
177
  rubygems_version: 1.8.25