enumerable-proxy 1.1.1 → 1.1.2

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.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ *.sw?
2
+ .DS_Store
3
+ coverage
4
+ rdoc
5
+ pkg
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Jacob Rothstein
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,56 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "enumerable-proxy"
8
+ gem.summary = %Q{[1,2,3].map.to_s == %w(1 2 3)}
9
+ gem.description = %Q{EnumerableProxy is a pattern for simple block-free ruby enumeration}
10
+ gem.email = "github@jacobrothstein.com"
11
+ gem.homepage = "http://github.com/jbr/enumerable--proxy"
12
+ gem.authors = ["Jacob Rothstein"]
13
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
14
+ end
15
+ Jeweler::GemcutterTasks.new
16
+ rescue LoadError
17
+ puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
18
+ end
19
+
20
+ require 'rake/testtask'
21
+ Rake::TestTask.new(:test) do |test|
22
+ test.libs << 'lib' << 'test'
23
+ test.pattern = 'test/**/*_test.rb'
24
+ test.verbose = true
25
+ end
26
+
27
+ begin
28
+ require 'rcov/rcovtask'
29
+ Rcov::RcovTask.new do |test|
30
+ test.libs << 'test'
31
+ test.pattern = 'test/**/*_test.rb'
32
+ test.verbose = true
33
+ end
34
+ rescue LoadError
35
+ task :rcov do
36
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
37
+ end
38
+ end
39
+
40
+ task :test => :check_dependencies
41
+
42
+ task :default => :test
43
+
44
+ require 'rake/rdoctask'
45
+ Rake::RDocTask.new do |rdoc|
46
+ if File.exist?('VERSION')
47
+ version = File.read('VERSION')
48
+ else
49
+ version = ""
50
+ end
51
+
52
+ rdoc.rdoc_dir = 'rdoc'
53
+ rdoc.title = "enumerable proxy #{version}"
54
+ rdoc.rdoc_files.include('README*')
55
+ rdoc.rdoc_files.include('lib/**/*.rb')
56
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.1.2
@@ -0,0 +1,49 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{enumerable-proxy}
8
+ s.version = "1.1.2"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Jacob Rothstein"]
12
+ s.date = %q{2009-10-31}
13
+ s.description = %q{EnumerableProxy is a pattern for simple block-free ruby enumeration}
14
+ s.email = %q{github@jacobrothstein.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ ".gitignore",
22
+ "LICENSE",
23
+ "README",
24
+ "Rakefile",
25
+ "VERSION",
26
+ "enumerable-proxy.gemspec",
27
+ "lib/enumerable_proxy.rb",
28
+ "lib/enumerable_proxy/array_extensions.rb",
29
+ "test/test_helper.rb"
30
+ ]
31
+ s.homepage = %q{http://github.com/jbr/enumerable--proxy}
32
+ s.rdoc_options = ["--charset=UTF-8"]
33
+ s.require_paths = ["lib"]
34
+ s.rubygems_version = %q{1.3.5}
35
+ s.summary = %q{[1,2,3].map.to_s == %w(1 2 3)}
36
+ s.test_files = [
37
+ "test/test_helper.rb"
38
+ ]
39
+
40
+ if s.respond_to? :specification_version then
41
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
42
+ s.specification_version = 3
43
+
44
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
45
+ else
46
+ end
47
+ else
48
+ end
49
+ end
@@ -1,31 +1,22 @@
1
- module Enumerable
2
- def proxy(method) Proxy.new method, self end
1
+ module EnumerableProxy
2
+ def self.included(klass)
3
+ klass.class_eval do
4
+ def proxy(method) Proxy.new method, self end
5
+ alias_method :p, :proxy
6
+ end
7
+ end
3
8
 
4
9
  class Proxy
5
10
  instance_methods.each { |m| undef_method m unless m =~ /^__/ }
6
-
11
+
7
12
  def initialize(method, enumerable)
8
13
  @method, @enumerable = method, enumerable
9
14
  end
10
-
15
+
11
16
  def method_missing(method, *args)
12
17
  @enumerable.send(@method) {|a| a.send method, *args}
13
18
  end
14
19
  end
15
20
  end
16
21
 
17
- class Array
18
- %w(each map select reject all?).each do |method|
19
- aliased_target, punctuation = method.to_s.sub(/([?!])$/, ''), $1
20
- with_proxy = "#{aliased_target}_with_proxy#{punctuation}"
21
- without_proxy = with_proxy.sub "with", "without"
22
-
23
- class_eval %{
24
- def #{with_proxy}(&blk)
25
- blk.nil? ? proxy(:#{method}) : #{without_proxy}(&blk)
26
- end
27
- alias_method :#{without_proxy}, :#{method}
28
- alias_method :#{method}, :#{with_proxy}
29
- }
30
- end
31
- end
22
+ Enumerable.instance_eval {include EnumerableProxy}
@@ -0,0 +1,21 @@
1
+ module EnumerableProxy
2
+ module ArrayExtensions
3
+ def self.included(klass)
4
+ %w(each map select reject all?).each do |method|
5
+ aliased_target, punctuation = method.to_s.sub(/([?!])$/, ''), $1
6
+ with_proxy = "#{aliased_target}_with_proxy#{punctuation}"
7
+ without_proxy = with_proxy.sub "with", "without"
8
+
9
+ klass.class_eval %{
10
+ def #{with_proxy}(&blk)
11
+ blk.nil? ? proxy(:#{method}) : #{without_proxy}(&blk)
12
+ end
13
+ alias_method :#{without_proxy}, :#{method}
14
+ alias_method :#{method}, :#{with_proxy}
15
+ }
16
+ end
17
+ end
18
+ end
19
+ end
20
+
21
+ Array.instance_eval { include EnumerableProxy::ArrayExtensions }
@@ -0,0 +1,9 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+
4
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
5
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
+ require 'enuprox'
7
+
8
+ class Test::Unit::TestCase
9
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enumerable-proxy
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jacob Rothstein
@@ -9,45 +9,36 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-09-25 00:00:00 -07:00
12
+ date: 2009-10-31 00:00:00 -07:00
13
13
  default_executable:
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: mime-types
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: "1.15"
24
- version:
25
- - !ruby/object:Gem::Dependency
26
- name: diff-lcs
27
- type: :runtime
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: 1.1.2
34
- version:
35
- description: Enumerable::Proxy is a pattern for simple block-free ruby enumeration
36
- email: jacob@stormweight.com
14
+ dependencies: []
15
+
16
+ description: EnumerableProxy is a pattern for simple block-free ruby enumeration
17
+ email: github@jacobrothstein.com
37
18
  executables: []
38
19
 
39
20
  extensions: []
40
21
 
41
22
  extra_rdoc_files:
23
+ - LICENSE
42
24
  - README
43
25
  files:
44
- - lib/enumerable_proxy.rb
26
+ - .document
27
+ - .gitignore
28
+ - LICENSE
45
29
  - README
46
- has_rdoc: false
47
- homepage: http://github.com/jbr/Enumerable--Proxy
30
+ - Rakefile
31
+ - VERSION
32
+ - enumerable-proxy.gemspec
33
+ - lib/enumerable_proxy.rb
34
+ - lib/enumerable_proxy/array_extensions.rb
35
+ - test/test_helper.rb
36
+ has_rdoc: true
37
+ homepage: http://github.com/jbr/enumerable--proxy
38
+ licenses: []
39
+
48
40
  post_install_message:
49
41
  rdoc_options:
50
- - --inline-source
51
42
  - --charset=UTF-8
52
43
  require_paths:
53
44
  - lib
@@ -66,9 +57,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
66
57
  requirements: []
67
58
 
68
59
  rubyforge_project:
69
- rubygems_version: 1.3.1
60
+ rubygems_version: 1.3.5
70
61
  signing_key:
71
- specification_version: 2
72
- summary: Enumerable::Proxy is a pattern for simple block-free ruby enumeration
73
- test_files: []
74
-
62
+ specification_version: 3
63
+ summary: "[1,2,3].map.to_s == %w(1 2 3)"
64
+ test_files:
65
+ - test/test_helper.rb