spelunk 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +7 -0
  2. data/lib/spelunk.rb +24 -0
  3. data/lib/spelunk/version.rb +42 -0
  4. metadata +44 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5507794c4a5a887782f54506b690f23a621eafca
4
+ data.tar.gz: 96ac237b4fe793e12c12e78c7446c63f005e6606
5
+ SHA512:
6
+ metadata.gz: cbb058cdb46af952d6cf5253e4af66ae55b5ea174b1a445c0a2ef274921d3eb37934601f2d2d9c40ace9580ff3d7f9ddd8f420b1de9aa519b5c2ee536bf38a62
7
+ data.tar.gz: 9836347dbc928d9826d920b87186f64d9fb1da2a66055bc21027245543d742511a162c46fa5ac7a2711faf5fa7a9eb8e5482447d55ff509d02f30b54b6e4ec24
@@ -0,0 +1,24 @@
1
+ require 'spelunk/version'
2
+ module Spelunk
3
+ def self.methods_for object
4
+ get_methods_for object, :""
5
+ end
6
+
7
+ def self.private_methods_for object
8
+ get_methods_for object, :"private_"
9
+ end
10
+
11
+ def self.public_methods_for object
12
+ get_methods_for object, :"public_"
13
+ end
14
+
15
+ private
16
+ def self.get_methods_for object, type = :""
17
+ base_object = object.class.eql?(Kernel.const_get(object.class.to_s)) ? Object : Object.new
18
+ default_methods = base_object.send(:"#{type}methods")
19
+ all_methods = object.send(:"#{type}methods")
20
+ left_overs = all_methods - default_methods
21
+ left_overs
22
+ end
23
+
24
+ end
@@ -0,0 +1,42 @@
1
+ module Spelunk
2
+ def self.version
3
+ VERSION
4
+ end
5
+
6
+ module VERSION
7
+ extend Comparable
8
+
9
+ MAJOR = 0
10
+ MINOR = 0
11
+ TINY = 1
12
+ SIGNATURE = [MAJOR, MINOR, TINY]
13
+ STRING = SIGNATURE.join '.'
14
+
15
+ def self.major; MAJOR end
16
+ def self.minor; MINOR end
17
+ def self.tiny; TINY end
18
+ def self.to_s; STRING end
19
+
20
+ def self.hash
21
+ STRING.hash
22
+ end
23
+
24
+ def self.<=>(other)
25
+ other = other.split('.').map { |i| i.to_i } if other.respond_to? :split
26
+ SIGNATURE <=> Array(other)
27
+ end
28
+
29
+ def self.inspect
30
+ STRING.inspect
31
+ end
32
+
33
+ def self.respond_to?(meth, *)
34
+ meth.to_s !~ /^__|^to_str$/ and STRING.respond_to? meth unless super
35
+ end
36
+
37
+ def self.method_missing(meth, *args, &block)
38
+ return super unless STRING.respond_to?(meth)
39
+ STRING.send(meth, *args, &block)
40
+ end
41
+ end
42
+ end
metadata ADDED
@@ -0,0 +1,44 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: spelunk
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Ryan Castro
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-10-30 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Spelunk unfamiliar Objects and view only its relevant methods.
14
+ email: git@ryancastro.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/spelunk.rb
20
+ - lib/spelunk/version.rb
21
+ homepage: http://github.com/rcastro/spelunk
22
+ licenses: []
23
+ metadata: {}
24
+ post_install_message:
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ requirements: []
39
+ rubyforge_project:
40
+ rubygems_version: 2.0.14
41
+ signing_key:
42
+ specification_version: 4
43
+ summary: Spelunk unfamiliar Objects and view only its relevant methods.
44
+ test_files: []