t 0.9.2 → 0.9.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/t/printable.rb +19 -6
  2. data/lib/t/version.rb +1 -1
  3. metadata +1 -1
data/lib/t/printable.rb CHANGED
@@ -5,6 +5,7 @@ require 'fastercsv' unless Array.new.respond_to?(:to_csv)
5
5
  require 'highline'
6
6
  require 'htmlentities'
7
7
  require 'thor/shell/color'
8
+ require 'time'
8
9
 
9
10
  module T
10
11
  module Printable
@@ -16,32 +17,44 @@ module T
16
17
  private
17
18
 
18
19
  def build_long_list(list)
19
- created_at = list.created_at > 6.months.ago ? list.created_at.strftime("%b %e %H:%M") : list.created_at.strftime("%b %e %Y")
20
+ created_at = if Time.parse(list.created_at.to_s) > 6.months.ago
21
+ list.created_at.strftime("%b %e %H:%M")
22
+ else
23
+ list.created_at.strftime("%b %e %Y")
24
+ end
20
25
  [list.id, created_at, "@#{list.user.screen_name}", list.slug, number_with_delimiter(list.member_count), number_with_delimiter(list.subscriber_count), list.mode, list.description]
21
26
  end
22
27
 
23
28
  def build_long_status(status)
24
- created_at = status.created_at > 6.months.ago ? status.created_at.strftime("%b %e %H:%M") : status.created_at.strftime("%b %e %Y")
29
+ created_at = if Time.parse(status.created_at.to_s) > 6.months.ago
30
+ Time.parse(status.created_at.to_s).strftime("%b %e %H:%M")
31
+ else
32
+ Time.parse(status.created_at.to_s).strftime("%b %e %Y")
33
+ end
25
34
  [status.id, created_at, "@#{status.user.screen_name}", HTMLEntities.new.decode(status.text).gsub(/\n+/, ' ')]
26
35
  end
27
36
 
28
37
  def build_long_user(user)
29
- created_at = user.created_at > 6.months.ago ? user.created_at.strftime("%b %e %H:%M") : user.created_at.strftime("%b %e %Y")
38
+ created_at = if user.created_at > 6.months.ago
39
+ Time.parse(user.created_at.to_s).strftime("%b %e %H:%M")
40
+ else
41
+ user.created_at.strftime("%b %e %Y")
42
+ end
30
43
  [user.id, created_at, number_with_delimiter(user.statuses_count), number_with_delimiter(user.favourites_count), number_with_delimiter(user.listed_count), number_with_delimiter(user.friends_count), number_with_delimiter(user.followers_count), "@#{user.screen_name}", user.name]
31
44
  end
32
45
 
33
46
  def print_csv_list(list)
34
- created_at = list.created_at.utc.strftime("%Y-%m-%d %H:%M:%S %z")
47
+ created_at = Time.parse(list.created_at.to_s).utc.strftime("%Y-%m-%d %H:%M:%S %z")
35
48
  say [list.id, created_at, list.user.screen_name, list.slug, list.member_count, list.subscriber_count, list.mode, list.description].to_csv
36
49
  end
37
50
 
38
51
  def print_csv_status(status)
39
- created_at = status.created_at.utc.strftime("%Y-%m-%d %H:%M:%S %z")
52
+ created_at = Time.parse(status.created_at.to_s).utc.strftime("%Y-%m-%d %H:%M:%S %z")
40
53
  say [status.id, created_at, status.user.screen_name, HTMLEntities.new.decode(status.text)].to_csv
41
54
  end
42
55
 
43
56
  def print_csv_user(user)
44
- created_at = user.created_at.utc.strftime("%Y-%m-%d %H:%M:%S %z")
57
+ created_at = Time.parse(user.created_at.to_s).utc.strftime("%Y-%m-%d %H:%M:%S %z")
45
58
  say [user.id, created_at, user.statuses_count, user.favourites_count, user.listed_count, user.friends_count, user.followers_count, user.screen_name, user.name].to_csv
46
59
  end
47
60
 
data/lib/t/version.rb CHANGED
@@ -13,7 +13,7 @@ module T
13
13
 
14
14
  # @return [Integer]
15
15
  def self.patch
16
- 2
16
+ 3
17
17
  end
18
18
 
19
19
  # @return [String, NilClass]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: t
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 0.9.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: