about_page 0.3.0 → 0.3.1

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.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NjI3YWY5NDQwMzNmOWY3MDUyMGFlMzZiZjZiYjI1NTA0ZmU3NzYwMw==
4
+ ZmFiZGRmODlmYzY0ZGFkYThkNTM4Yjg3M2E5ODE0ZWZiYTFmOGEwNg==
5
5
  data.tar.gz: !binary |-
6
- NGFkZTQ2N2U1YmI4OGYzMjc3NjM1MDIwYTVhYWIyNDEzYThmMmIzMQ==
6
+ ZDA4ZjI4ZDBhYjBmMjNhZWZiZWQzOWUxNzczYTk5NjA2NzYwYWYxYg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZDFiZTI2MDYzNmU5YjZmM2Y1NDMwZTE0OTYwYjBkNjMwOTBjNmE1YjI0OWQ0
10
- YjVlMmNkYmY1MWY2MWZjZTE5ZWQxMDBkMDE0MDg4YjhjMGZjMjZiZjg0OGM1
11
- OWEyNGEwZjg0OTNhOTkyZjEwMGM4MTliOTBjYWQ2NDk3M2E1NTY=
9
+ NWU2ZTlkZTgzZGEwZTM2Yzk4OWIwZjNhYmI5Y2E5MGUzYzQwNzFiMmFkNTk0
10
+ ZDAxZTc1ZWM2NGQyMDAxOGE0NzA2OWYzNTcyNzljM2MyM2MzNmQ1NzJkOTgx
11
+ ZDlkMjhjY2E5YWY4ODZmZjMwMzQyMTRlZGIzYmU0ZTY5MTEzMzE=
12
12
  data.tar.gz: !binary |-
13
- NjNhNDU5NDE1NGQwNWE4ZjZjOTMyYmMzNWFlY2RkMzA0NDhiZmU2NDg1ZWJj
14
- Njg3ZjQwYzJkYzJiZGNlN2IxMTgxZGNiNTMzYmI2MjNkZDU1OTZiOWRmMmMw
15
- Yjk1ZGMyY2FmMWUwZDJhMjZiYWY3N2I5NjUyMmU0NDc5NjQwNGU=
13
+ YmZkMmNkMjM2OGFmMmVhZWRiNTczY2RjNzY4OTAyYmZjOGYyYWI1ZjMwNjdl
14
+ NjUyMjY5Y2E0OGVjODk2ZWEyZTU0ODU3ZWY3ZDE1NjY1Yzg4MjdmN2M0YTVk
15
+ YzI2OTU1MzExNWFhNTZmYjU2ZGM1MjVjZTNiZTAxZGVjZDlkYTc=
@@ -6,23 +6,26 @@ module AboutPage
6
6
 
7
7
  def initialize(opts = {})
8
8
  root = opts.fetch(:root, Rails.root)
9
- limit = opts.fetch(:limit, %r{/tags/})
10
- repo = Grit::Repo.new(root)
11
- refs = repo.refs_list.inject(Hash.new { |h,k| h[k] = [] }) { |h,r| h[r[1]] << r[0]; h }
12
- @commits = repo.log(repo.head.name).inject([]) do |a,c|
9
+ @limit = opts.fetch(:limit, %r{/tags/})
10
+ @repo = Grit::Repo.new(root)
11
+ end
12
+
13
+ def commits
14
+ refs = @repo.refs_list.inject(Hash.new { |h,k| h[k] = [] }) { |h,r| h[r[1]] << r[0]; h }
15
+ @repo.log(@repo.head.name).inject([]) do |a,c|
13
16
  a << { :commit => c.to_hash, :refs => refs[c.sha] }
14
- bail = case limit
15
- when Fixnum then a.length == limit
16
- when Regexp then a.last[:refs].any? { |ref| ref =~ limit }
17
- when Time then c.committed_date < limit
18
- when Proc then limit.call(c)
17
+ bail = case @limit
18
+ when Fixnum then a.length == @limit
19
+ when Regexp then a.last[:refs].any? { |ref| ref =~ @limit }
20
+ when Time then c.committed_date < @limit
21
+ when Proc then @limit.call(c)
19
22
  end
20
23
  if bail then break(a) else a end
21
24
  end
22
25
  end
23
26
 
24
27
  def to_h
25
- @commits
28
+ commits
26
29
  end
27
30
  end
28
31
  end
@@ -1,3 +1,3 @@
1
1
  module AboutPage
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: about_page
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael B. Klein