pryable 0.1.3 → 0.1.4.pre

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.
@@ -1,8 +1,29 @@
1
- = pryable
1
+ = *Pryable*
2
2
 
3
3
  Give your classes some introspection from Pry.
4
4
 
5
- == Contributing to pryable
5
+ To use, include Pryable:
6
+ <pre>
7
+ <code>
8
+ include Pryable
9
+ </code>
10
+ </pre>
11
+
12
+ Then, either in the body of a method or in irb, just call #pry_open, like:
13
+ <pre>
14
+ <code>
15
+ def do_something
16
+ @setup = something
17
+ pry_open
18
+ end
19
+ </code>
20
+ </pre>
21
+
22
+ You will be launched into a Pry session _inside_ the current context. You can use familiar-looking Pry commands then, such as @ls@, @cd Module@, @cd Class@, @cd ..@
23
+
24
+ *Pryable* is in active development, so expect the API to change and features to be added. If you'd like to help out, see the guidelines below.
25
+
26
+ == Contributing to *Pryable*
6
27
 
7
28
  * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
8
29
  * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
data/lib/pryable.rb CHANGED
@@ -1,12 +1,26 @@
1
1
  module Pryable
2
+ require 'benchmark'
3
+ # begin
4
+ # require 'pry'
5
+ # module Rails
6
+ # class Console
7
+ # class IRB
8
+ # def self.start
9
+ # Pry.start
10
+ # end
11
+ # end
12
+ # end
13
+ # end
14
+ # rescue LoadError
15
+ # end
2
16
 
3
17
  module Version
4
18
  MAJOR = 0
5
19
  MINOR = 1
6
- PATCH = 3
7
- #BUILD = ''
20
+ PATCH = 4
21
+ BUILD = 'pre'
8
22
 
9
- STRING = [MAJOR, MINOR, PATCH].compact.join('.')
23
+ STRING = [MAJOR, MINOR, PATCH, (BUILD unless BUILD.empty?)].compact.join('.')
10
24
  end
11
25
 
12
26
  def self.included(base)
@@ -14,16 +28,38 @@ module Pryable
14
28
  end
15
29
 
16
30
  def pry_open
17
- start_time = DateTime.now
31
+ log_prying_session {
32
+ binding.pry
33
+ }
34
+ end
35
+
36
+ def log_prying_session(&block)
18
37
  Rails.logger.info "====== Beginning Pry Session ====== Binding: #{self.inspect} ======"
19
- binding.pry
20
- end_time = DateTime.now
21
- elapsed = end_time - start_time
22
- Rails.logger.info "====== Ending Pry Session ====== Time Elapsed: #{elapsed} ======"
38
+ start = Time.now
39
+ yield
40
+ finish = Time.now
41
+ elapsed = finish.to_f - start.to_f
42
+ mins, secs = elapsed.divmod 60.0
43
+ min = mins.zero? ? "" : "#{mins.ceil}m "
44
+ sec = "#{secs.ceil}s"
45
+ time = min + sec
46
+ Rails.logger.info "====== Ending Pry Session ====== Session Time: #{time} ======"
23
47
  end
24
48
 
25
49
 
26
50
  module ClassMethods
27
- require 'pry'
51
+ begin
52
+ require 'pry'
53
+ module Rails
54
+ class Console
55
+ class IRB
56
+ def self.start
57
+ Pry.start
58
+ end
59
+ end
60
+ end
61
+ end
62
+ rescue LoadError
63
+ end
28
64
  end
29
65
  end
data/pryable.gemspec CHANGED
@@ -5,23 +5,23 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{pryable}
8
- s.version = "0.1.3"
8
+ s.version = "0.1.4.pre"
9
9
 
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
10
+ s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Mark Coates (oddlyzen)"]
12
- s.date = %q{2011-06-21}
12
+ s.date = %q{2011-06-22}
13
13
  s.description = %q{Uses Pry (http://rdoc.info/github/banister/pry/master/file/README.markdown) as a debugger and introspection tool.}
14
14
  s.email = %q{mark.coates@gmail.com}
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE.txt",
17
- "README.rdoc"
17
+ "README.textile"
18
18
  ]
19
19
  s.files = [
20
20
  ".document",
21
21
  "Gemfile",
22
22
  "Gemfile.lock",
23
23
  "LICENSE.txt",
24
- "README.rdoc",
24
+ "README.textile",
25
25
  "Rakefile",
26
26
  "lib/pryable.rb",
27
27
  "pryable.gemspec",
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pryable
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
4
+ prerelease: true
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 3
9
- version: 0.1.3
8
+ - 4
9
+ - pre
10
+ version: 0.1.4.pre
10
11
  platform: ruby
11
12
  authors:
12
13
  - Mark Coates (oddlyzen)
@@ -14,7 +15,7 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2011-06-21 00:00:00 -04:00
18
+ date: 2011-06-22 00:00:00 -04:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
@@ -94,13 +95,13 @@ extensions: []
94
95
 
95
96
  extra_rdoc_files:
96
97
  - LICENSE.txt
97
- - README.rdoc
98
+ - README.textile
98
99
  files:
99
100
  - .document
100
101
  - Gemfile
101
102
  - Gemfile.lock
102
103
  - LICENSE.txt
103
- - README.rdoc
104
+ - README.textile
104
105
  - Rakefile
105
106
  - lib/pryable.rb
106
107
  - pryable.gemspec
@@ -120,18 +121,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
120
121
  requirements:
121
122
  - - ">="
122
123
  - !ruby/object:Gem::Version
123
- hash: 2734099716429498239
124
+ hash: -3513952177039130666
124
125
  segments:
125
126
  - 0
126
127
  version: "0"
127
128
  required_rubygems_version: !ruby/object:Gem::Requirement
128
129
  none: false
129
130
  requirements:
130
- - - ">="
131
+ - - ">"
131
132
  - !ruby/object:Gem::Version
132
133
  segments:
133
- - 0
134
- version: "0"
134
+ - 1
135
+ - 3
136
+ - 1
137
+ version: 1.3.1
135
138
  requirements: []
136
139
 
137
140
  rubyforge_project: