goat 0.2.10 → 0.2.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/goat.rb +26 -1
  2. metadata +4 -4
@@ -32,8 +32,11 @@ class Object
32
32
  end
33
33
 
34
34
  def make_me; self.class.make_me end
35
+
36
+ alias_method :old_kind_of?, :kind_of?
35
37
 
36
38
  def self.kind_of?(cls)
39
+ return true if self.old_kind_of?(Class) && cls == Class
37
40
  self == cls || \
38
41
  (self == Object ? \
39
42
  false : \
@@ -108,7 +111,29 @@ class String
108
111
  end
109
112
  end
110
113
 
111
- module Goat
114
+ module Goat
115
+ def self.version
116
+ if @version
117
+ @version
118
+ elsif !@tried_to_detect_version
119
+ @tried_to_detect_version = true
120
+ path = File.join(File.dirname(__FILE__), '../goat.gemspec')
121
+ if File.exists?(path)
122
+ v = File.read(path).split("\n").select{|l| l =~ /version/}.first
123
+ if v && v =~ /["']([0-9\.]+)["']/
124
+ @version = $1
125
+ end
126
+ elsif
127
+ dir = File.expand_path(File.dirname(__FILE__))
128
+ if dir =~ /goat-([0-9\.]+)\//
129
+ @version = $1
130
+ end
131
+ end
132
+ else
133
+ nil
134
+ end
135
+ end
136
+
112
137
  def self.goat_path(f); File.join(File.dirname(__FILE__), 'goat', f); end
113
138
 
114
139
  def self.extend_sinatra
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: goat
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
4
+ hash: 15
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 10
10
- version: 0.2.10
9
+ - 12
10
+ version: 0.2.12
11
11
  platform: ruby
12
12
  authors:
13
13
  - Patrick Collison
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-09-23 00:00:00 +00:00
18
+ date: 2010-11-10 00:00:00 +00:00
19
19
  default_executable:
20
20
  dependencies: []
21
21