mixi-community 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -46,6 +46,10 @@ See source for details.
46
46
 
47
47
  ## Changes
48
48
 
49
+ ### 0.0.4
50
+
51
+ * Support new date format(again!)
52
+
49
53
  ### 0.0.3
50
54
 
51
55
  * Support new date format
@@ -88,12 +88,20 @@ module Mixi
88
88
  end
89
89
 
90
90
  def parse_comment_time(time_str)
91
- format = '%m月%d日 %H:%M'
92
91
  time_str = time_str.strip
92
+ formats = ['%Y年%m月%d日 %H:%M', '%m月%d日 %H:%M']
93
+ formats.each do|format|
94
+ time = try_strptime(format, time_str)
95
+ return time if time
96
+ end
97
+ raise ArgumentError, "Time format not matched: formats=#{formats.join(', ')}, input=#{time_str}"
98
+ end
99
+
100
+ def try_strptime(format, str)
93
101
  begin
94
- Time.strptime(time_str, format)
102
+ Time.strptime(str, format)
95
103
  rescue ArgumentError
96
- raise ArgumentError, "Time format not matched: format=#{format}, input=#{time_str}"
104
+ nil
97
105
  end
98
106
  end
99
107
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = "mixi-community"
3
- gem.version = "0.0.3"
3
+ gem.version = "0.0.4"
4
4
  gem.authors = ["todesking"]
5
5
  gem.email = ["discommunicative@gmail.com"]
6
6
  gem.summary = %q{Access to Mixi community.}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mixi-community
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
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-10-18 00:00:00.000000000 Z
12
+ date: 2013-10-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mechanize