cowtech-extensions 1.1.4.0 → 1.2.0.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.
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{cowtech-extensions}
8
- s.version = "1.1.4.0"
8
+ s.version = "1.2.0.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = [%q{Shogun}]
12
- s.date = %q{2011-09-13}
12
+ s.date = %q{2011-09-20}
13
13
  s.description = %q{Several Ruby object enhancements.}
14
14
  s.email = %q{shogun_panda@me.com}
15
15
  s.extra_rdoc_files = [
@@ -13,6 +13,10 @@ module Cowtech
13
13
  def to_i
14
14
  (self == true) ? 1 : 0
15
15
  end
16
+
17
+ def value
18
+ self
19
+ end
16
20
  end
17
21
  end
18
22
  end
@@ -96,22 +96,16 @@ module Cowtech
96
96
 
97
97
  module InstanceMethods
98
98
  def lstrftime(format = nil)
99
- format = self.class.custom_format($1) if format =~ /^custom::(.+)/
100
- unlocal = self.strftime(format || self.class.custom_format("update"))
101
-
102
- [
103
- [self.class.default_localized_months, self.class.localized_months], [self.class.default_localized_days, self.class.localized_days],
104
- [self.class.default_localized_short_months, self.class.localized_short_months], [self.class.default_localized_short_days, self.class.localized_short_days]
105
- ].each do |iter|
106
- dict = {}
107
-
108
- iter[0].each_index { |i|
109
- key = iter[0][i]
110
- value = iter[1][i]
111
- dict[key] = value
112
- }
113
-
114
- unlocal.gsub!(/(#{dict.keys.join("|")})/i) { |s| dict[$1] }
99
+ format = self.class.custom_format($1) if format =~ /^custom::(.+)/
100
+ format ||= self.class.custom_format("update")
101
+ unlocal = self.strftime(format)
102
+
103
+ { "%a" => "short_days", "%A" => "days", "%b" => "short_months", "%B" => "months" }.each_pair do |specifier, method|
104
+ if format.include?(specifier) then
105
+ from = self.class.send('default_localized_' + method)
106
+ to = self.class.send('localized_' + method)
107
+ unlocal.gsub!(/(#{from.join("|")})/i) { |s| to[from.index($1)] }
108
+ end
115
109
  end
116
110
 
117
111
  unlocal
@@ -23,6 +23,10 @@ module Cowtech
23
23
  def replace_ampersands
24
24
  self.gsub(/&(\S+);/, "&\\1;")
25
25
  end
26
+
27
+ def value
28
+ self
29
+ end
26
30
  end
27
31
  end
28
32
  end
@@ -10,8 +10,8 @@ module Cowtech
10
10
  module Extensions
11
11
  module Version
12
12
  MAJOR = 1
13
- MINOR = 1
14
- PATCH = 4
13
+ MINOR = 2
14
+ PATCH = 0
15
15
  BUILD = 0
16
16
 
17
17
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cowtech-extensions
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4.0
4
+ version: 1.2.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-09-13 00:00:00.000000000Z
12
+ date: 2011-09-20 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jeweler
16
- requirement: &70109196735060 !ruby/object:Gem::Requirement
16
+ requirement: &70284745070960 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70109196735060
24
+ version_requirements: *70284745070960
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: actionpack
27
- requirement: &70109196734220 !ruby/object:Gem::Requirement
27
+ requirement: &70284745069320 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70109196734220
35
+ version_requirements: *70284745069320
36
36
  description: Several Ruby object enhancements.
37
37
  email: shogun_panda@me.com
38
38
  executables: []