mack-facets 0.8.0.101 → 0.8.1

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,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
@@ -11,6 +11,11 @@ class File
11
11
  _original_join(fs.collect{|c| c.to_s})
12
12
  end
13
13
 
14
+ def join_from_here(*args)
15
+ caller.first.match(/(.+):.+/)
16
+ File.expand_path(File.join(File.dirname($1), *args))
17
+ end
18
+
14
19
  end
15
20
 
16
21
  end
@@ -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,
@@ -3,6 +3,10 @@ class String
3
3
 
4
4
  alias_instance_method :snakecase, :underscore
5
5
 
6
+ def /(other)
7
+ File.join(self, other.to_s)
8
+ end
9
+
6
10
  def methodize
7
11
  x = self
8
12
 
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.0.101
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-11 00:00:00 -04:00
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.5
43
+ version: 0.9.8
44
44
  version:
45
45
  description: "mack-facets was developed by: markbates"
46
46
  email: mark@mackframework.com