andand2 0.0.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.
@@ -0,0 +1,43 @@
1
+ # possibly-better-but-at-least-different version of andand.
2
+ # myObject.andand.method.garbage.method.garbage.garbage.garbage.method.method.garbage
3
+ # ... works, unlike with the standard andand.
4
+
5
+ class Object
6
+ def andand
7
+ AndAnd.new(self)
8
+ end
9
+ end
10
+
11
+ class AndAnd
12
+
13
+ (instance_methods-["__id__","__send__"]).each do |meth|
14
+ eval("undef #{meth.to_s}")
15
+ end
16
+
17
+ @@and_and_nil = nil
18
+ def @@and_and_nil.method_missing(sym, *args)
19
+ @@and_and_nil
20
+ end
21
+
22
+ def inspect
23
+ @_obj.inspect
24
+ end
25
+
26
+ def initialize(contents)
27
+ @_obj = contents
28
+ end
29
+
30
+ def method_missing(sym, *args)
31
+ if @_obj.respond_to?(sym)
32
+ AndAnd.new(@_obj.send(sym, *args))
33
+ else
34
+ AndAnd.new(@@and_and_nil)
35
+ end
36
+ end
37
+
38
+ def self.unbind(andanded)
39
+ x = andanded.instance_eval("@_obj")
40
+ x == @@and_and_nil ? nil : x
41
+ end
42
+
43
+ end
@@ -0,0 +1,11 @@
1
+ require 'rubygems'
2
+
3
+ # require something.
4
+
5
+ gem "rspec", ">=1.2.5"
6
+
7
+ Spec::Runner.configure do |config|
8
+
9
+ end
10
+
11
+
@@ -0,0 +1 @@
1
+ --colour
metadata ADDED
@@ -0,0 +1,57 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: andand2
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Burke Libbey
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2010-01-25 00:00:00 -06:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: Unlike andand, andand2 can be placed at the start of a chain, not just where you anticipate nils.
17
+ email: burke@burkelibbey.org
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files: []
23
+
24
+ files:
25
+ - lib/andand2.rb
26
+ - spec/spec_helper.rb
27
+ - spec/spec_opts.rb
28
+ has_rdoc: true
29
+ homepage: http://github.com/burke/andand2
30
+ licenses: []
31
+
32
+ post_install_message:
33
+ rdoc_options:
34
+ - --charset=UTF-8
35
+ require_paths:
36
+ - lib
37
+ required_ruby_version: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: "0"
42
+ version:
43
+ required_rubygems_version: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: "0"
48
+ version:
49
+ requirements: []
50
+
51
+ rubyforge_project:
52
+ rubygems_version: 1.3.5
53
+ signing_key:
54
+ specification_version: 3
55
+ summary: Just like andand, except better.
56
+ test_files: []
57
+