github-buttons 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/github-buttons.rb +13 -13
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6a8b21b6d3f7ee69cb9469fb53e62f12f79872f0
4
- data.tar.gz: 8ca848f6eb5266d36be3c8482f431171ccf66427
3
+ metadata.gz: 0967640dfd2d5929c0a5d2b9b6f326f756751708
4
+ data.tar.gz: 60497ccbc5679d60056e4d100c59bd3ab282bd68
5
5
  SHA512:
6
- metadata.gz: a2e21ecee60e53c38936a80297970a249857dfcbf03d9c3779454689e3181ae70481373e64c9d3b0e790d74f0ff6a088e66b64fbe3e831df795078d4f460360f
7
- data.tar.gz: c6f25c890cf6219800a6ef1470a82d750cfca4f067c405d4673d585f32a9ee90eabeafff8bc162c42c31cb355591bf573637e536e30721c9decccfaeb664884f
6
+ metadata.gz: c279279c5d86971dcab823845d772432248414a89734dc4b328d438536334c21015e9c3d44404398d622dbd853d382d50806eff51ac8fbabdf16c25a1d21e21e
7
+ data.tar.gz: 99864f16a3c44cd300895580031c062f871af8abe4b48a33f2e7cd93f250645062f36f9ee7ea219e0b2048defe942c9d8aea8167f5dbf1ce865e1d2299d7af11
@@ -10,23 +10,16 @@ module GitHub
10
10
  # Available GitHub Button types
11
11
  types = ['fork', 'star', 'follow']
12
12
 
13
- # Ensure button type exists
14
- unless types.include? type
15
- raise ArgumentError, %Q(#{type} button not available. Try "fork", "star" or "follow")
16
- end
17
-
18
- # Work around bug in GitHub Button repository
19
- # Requesting "watch" actually returns "star"
20
- # See: https://github.com/mdo/github-buttons/issues/42#issuecomment-19951052
21
- if type == 'star'
22
- type = 'watch'
23
- end
24
-
25
13
  # Ensure argument type is valid
26
14
  unless type.is_a? String
27
15
  raise ArgumentError, "Expected String, got #{type.class}"
28
16
  end
29
17
 
18
+ # Ensure button type exists
19
+ unless types.include? type
20
+ raise ArgumentError, %Q(#{type} button not available. Try "fork", "star" or "follow")
21
+ end
22
+
30
23
  # If no options are specified, pass none
31
24
  if options.empty?
32
25
  large = count = nil
@@ -36,8 +29,15 @@ module GitHub
36
29
  if options[:large] then size = "&size=large" end
37
30
  if options[:count] then count = "&count=true" end
38
31
 
32
+ # Work around bug in GitHub Button repository
33
+ # Requesting "watch" actually returns "star"
34
+ # See: https://github.com/mdo/github-buttons/issues/42#issuecomment-19951052
35
+ if type == 'star'
36
+ type = 'watch'
37
+ end
38
+
39
39
  # Return GitHub Button
40
- %Q(<iframe src="http://ghbtns.com/github-btn.html?user=#{@user}&repo=#{@repo}&type=#{type}#{size}#{count}" allowtransparency="true" frameborder="0" scrolling="0" width="250" height="30"></iframe>)
40
+ %Q(<iframe class="github-button #{type}" src="http://ghbtns.com/github-btn.html?user=#{@user}&repo=#{@repo}&type=#{type}#{size}#{count}" allowtransparency="true" frameborder="0" scrolling="0" width="120" height="30"></iframe>)
41
41
  end
42
42
  end
43
43
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: github-buttons
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - M. Maxwell Watson