mlhch 0.0.0

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.
Files changed (4) hide show
  1. checksums.yaml +7 -0
  2. data/lib/mlhch.rb +16 -0
  3. data/lib/mlhch/util.rb +44 -0
  4. metadata +45 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9ec073c0716f4a7b88c0272fa55d1f405c061b91
4
+ data.tar.gz: 4ebd3b12b5bdb69a43c107d8a3e7d490a4cfdc20
5
+ SHA512:
6
+ metadata.gz: c74de9f164fc1feab7083063e00e08f6c146fd165ca82e939dc1197a59557ceaf098a2f05f40f6add8e21454b9db3d97583acf101ff2511d636d9c14556629ca
7
+ data.tar.gz: cd59f0cf5168826d3ab82741b7b5f9f4d8fe5d29292a39d276f8aa6c3d89cf49b5ee63b72c42e9dba88ce0ea373b5b95cb2978439929b916a34bc6fc4691df7c
@@ -0,0 +1,16 @@
1
+ #
2
+ # ml_gems.rb
3
+ #
4
+
5
+ # @see http://guides.rubygems.org/make-your-own-gem/#first-gem
6
+ # The convention is to have one Ruby file with the same name as your gem, since
7
+ # that gets loaded when require 'ml_gems' is run. That one file is in charge
8
+ # of setting up your gem’s code and API.
9
+
10
+ require 'mlhch/util'
11
+
12
+ class Mlhch
13
+ def self.hi
14
+ puts "Hello world!"
15
+ end
16
+ end
@@ -0,0 +1,44 @@
1
+ #
2
+ # ml_gems/util.rb
3
+ #
4
+
5
+ module Kernel
6
+ def fm c, m = nil, output = false
7
+ if c.is_a? Class
8
+ current_klass = c
9
+ else
10
+ if c.is_a? Symbol
11
+ current_klass = self.class === Class ? self : self.class
12
+ m = c
13
+ end
14
+ end
15
+
16
+ s = ["Searching class method '#{m}' of #{current_klass}..."]
17
+ current_klass.ancestors.each do |klass|
18
+ begin
19
+ s << sprintf("%-40s - %-40s", klass, klass.method(m).source_location.join(':').gsub(/.*(app|gems)\//, ''))
20
+ rescue
21
+ nil
22
+ end
23
+ end
24
+ s << "Searching instance method '#{m}' of #{current_klass}..."
25
+ current_klass.ancestors.each do |klass|
26
+ begin
27
+ s << sprintf("%-40s - %-40s", klass, klass.instance_method(m).source_location.join(':').gsub(/.*(app|gems)\//, ''))
28
+ rescue
29
+ nil
30
+ end
31
+ end
32
+ if output
33
+ return '<pre>' + (s.map { |a| a = ERB::Util.html_escape(a) }.join("\n")) + '</pre>'
34
+ else
35
+ puts s.join("\n")
36
+ end
37
+ end
38
+
39
+ def pcall
40
+ caller.reverse.each_with_index do |a, i|
41
+ printf "%3s : %s\n", i, a.gsub(/.*(lib|ruby)\//, '')
42
+ end
43
+ end
44
+ end
metadata ADDED
@@ -0,0 +1,45 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mlhch
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Ma Lian
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-01-18 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: A starting point of using gem
14
+ email: malhch@gmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/mlhch.rb
20
+ - lib/mlhch/util.rb
21
+ homepage: http://rubygems.org/gems/mlhch
22
+ licenses:
23
+ - MIT
24
+ metadata: {}
25
+ post_install_message:
26
+ rdoc_options: []
27
+ require_paths:
28
+ - lib
29
+ required_ruby_version: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ required_rubygems_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - '>='
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ requirements: []
40
+ rubyforge_project:
41
+ rubygems_version: 2.1.10
42
+ signing_key:
43
+ specification_version: 4
44
+ summary: Ma Lian's first gem!
45
+ test_files: []