mack-facets 0.8.0.101 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,20 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'kernel.rb')
|
1
2
|
class Array
|
2
3
|
|
4
|
+
# alias_method :original_include?, :include?
|
5
|
+
alias_instance_method :include?
|
6
|
+
|
7
|
+
def include?(pat)
|
8
|
+
if pat.is_a?(Regexp)
|
9
|
+
self.each do |v|
|
10
|
+
return true if v.to_s.match(pat)
|
11
|
+
end
|
12
|
+
return false
|
13
|
+
else
|
14
|
+
return _original_include?(pat)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
3
18
|
# This method is useful when you have a method that looks like this:
|
4
19
|
# def foo(*args)
|
5
20
|
# do something
|
@@ -3,6 +3,15 @@ require 'stringio'
|
|
3
3
|
|
4
4
|
module Kernel
|
5
5
|
|
6
|
+
def run_once
|
7
|
+
path = File.expand_path(caller.first)
|
8
|
+
unless ($__already_run_block ||= []).include?(path)
|
9
|
+
yield
|
10
|
+
$__already_run_block << path
|
11
|
+
end
|
12
|
+
# puts "$__already_run_block: #{$__already_run_block.inspect}"
|
13
|
+
end
|
14
|
+
|
6
15
|
# Aliases an instance method to a new name. It will only do the aliasing once, to prevent
|
7
16
|
# issues with reloading a class and causing a StackLevel too deep error.
|
8
17
|
# The method takes two arguments, the first is the original name of the method, the second,
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mack-facets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- markbates
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-10-
|
12
|
+
date: 2008-10-26 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -40,7 +40,7 @@ dependencies:
|
|
40
40
|
requirements:
|
41
41
|
- - "="
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: 0.9.
|
43
|
+
version: 0.9.8
|
44
44
|
version:
|
45
45
|
description: "mack-facets was developed by: markbates"
|
46
46
|
email: mark@mackframework.com
|