usaidwat 0.0.4 → 0.0.5

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.
data/bin/usaidwat CHANGED
@@ -29,8 +29,7 @@ reddit_user = USaidWat::RedditUser.new ARGV.shift
29
29
  if ARGV.length == 0
30
30
  comments = reddit_user.retrieve_comments
31
31
  exit 2 unless comments
32
- max_key = 1
33
- comments.each { |c| max_key = c.first.length if c.first.length > max_key }
32
+ max_key = comments.longest_subreddit.length
34
33
  comments.each { |c| printf "%-*s %s\n", max_key, c.first, c.last }
35
34
  else
36
35
  subreddit = ARGV.shift
@@ -1,3 +1,9 @@
1
+ class Array
2
+ def longest_subreddit
3
+ max_by { |s| s.first.length }.first
4
+ end
5
+ end
6
+
1
7
  # Inspired by: http://nex-3.com/posts/73-git-style-automatic-paging-in-ruby
2
8
  def run_pager
3
9
  return if RUBY_PLATFORM =~ /win32/
@@ -1,3 +1,3 @@
1
1
  module USaidWat
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: usaidwat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
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: 2012-02-02 00:00:00.000000000 Z
12
+ date: 2012-02-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
16
- requirement: &70304619242880 !ruby/object:Gem::Requirement
16
+ requirement: &70099932685200 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: 1.6.5
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70304619242880
24
+ version_requirements: *70099932685200
25
25
  description: View a user's last 100 Reddit comments, organized by subreddit.
26
26
  email:
27
27
  - michael@monkey-robot.com