irregular_method 0.1.1 → 0.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/README.rdoc +3 -2
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/irregular_method.gemspec +5 -3
- data/lib/irregular_method.rb +1 -1
- data/spec/irregular_method_spec.rb +8 -1
- data/spec/models/plain_object.rb +11 -0
- data/spec/schema.rb +1 -1
- data/spec/spec_helper.rb +1 -0
- metadata +5 -3
data/README.rdoc
CHANGED
@@ -23,7 +23,7 @@ The purpose of irregular_method is to allow methods with regular expression name
|
|
23
23
|
|
24
24
|
All reg_def methods are passed back the MatchData and the arguments passed to the call. For instance, let's say we have this class:
|
25
25
|
|
26
|
-
class Layer
|
26
|
+
class Layer
|
27
27
|
|
28
28
|
cattr_accessor :layers
|
29
29
|
attr_accessible :index
|
@@ -63,8 +63,9 @@ You may have noticed that you can pass an array to to the reg_def. It will check
|
|
63
63
|
---
|
64
64
|
|
65
65
|
== Important Things (not from Demetri Martin)
|
66
|
+
* irregular_method can be used on ANY ruby object.
|
66
67
|
|
67
|
-
The reference to 'self' IS a reference to the instance of the class. Normally, it would be a reference to the class since it's being evaluated as a class method, but there's a workaround. In any case, using self to reference the instance of the class you're working with is absolutely correct.
|
68
|
+
* The reference to 'self' IS a reference to the instance of the class. Normally, it would be a reference to the class since it's being evaluated as a class method, but there's a workaround. In any case, using self to reference the instance of the class you're working with is absolutely correct.
|
68
69
|
|
69
70
|
== Copyright
|
70
71
|
|
data/Rakefile
CHANGED
@@ -6,7 +6,7 @@ begin
|
|
6
6
|
Jeweler::Tasks.new do |gem|
|
7
7
|
gem.name = "irregular_method"
|
8
8
|
gem.summary = "Method missing is messy. Fix it by defining regular expression methods."
|
9
|
-
gem.description = "Writing a bunch of case statements to handle regular expressions in method missing is just plain annoying. I suggest they get separated out and defined as their own methods. Well... ruby doesn't really let that happen,
|
9
|
+
gem.description = "Writing a bunch of case statements to handle regular expressions in method missing is just plain annoying. I suggest they get separated out and defined as their own methods. Well... ruby doesn't really let that happen, so this is the alternative."
|
10
10
|
gem.email = "mdnelson30@gmail.com"
|
11
11
|
gem.homepage = "http://github.com/mnelson/irregular_method"
|
12
12
|
gem.authors = ["Mike Nelson"]
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
data/irregular_method.gemspec
CHANGED
@@ -5,12 +5,12 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{irregular_method}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Mike Nelson"]
|
12
|
-
s.date = %q{2010-02-
|
13
|
-
s.description = %q{Writing a bunch of case statements to handle regular expressions in method missing is just plain annoying. I suggest they get separated out and defined as their own methods. Well... ruby doesn't really let that happen,
|
12
|
+
s.date = %q{2010-02-20}
|
13
|
+
s.description = %q{Writing a bunch of case statements to handle regular expressions in method missing is just plain annoying. I suggest they get separated out and defined as their own methods. Well... ruby doesn't really let that happen, so this is the alternative.}
|
14
14
|
s.email = %q{mdnelson30@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE",
|
@@ -27,6 +27,7 @@ Gem::Specification.new do |s|
|
|
27
27
|
"lib/irregular_method.rb",
|
28
28
|
"spec/irregular_method_spec.rb",
|
29
29
|
"spec/models/method_missing.rb",
|
30
|
+
"spec/models/plain_object.rb",
|
30
31
|
"spec/models/user.rb",
|
31
32
|
"spec/schema.rb",
|
32
33
|
"spec/spec.opts",
|
@@ -40,6 +41,7 @@ Gem::Specification.new do |s|
|
|
40
41
|
s.test_files = [
|
41
42
|
"spec/irregular_method_spec.rb",
|
42
43
|
"spec/models/method_missing.rb",
|
44
|
+
"spec/models/plain_object.rb",
|
43
45
|
"spec/models/user.rb",
|
44
46
|
"spec/schema.rb",
|
45
47
|
"spec/spec_helper.rb"
|
data/lib/irregular_method.rb
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
2
|
|
3
3
|
describe "IrregularMethod" do
|
4
|
-
|
4
|
+
|
5
|
+
it "should integrate with plain objects" do
|
6
|
+
p = PlainObject.new
|
7
|
+
p.important_really_awesome_things.should eql("Plain Object's say things like: really_awesome_things")
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should implement and bind reg_def properly" do
|
5
11
|
mm = MethodMissing.create(:name => 'mm1')
|
6
12
|
MethodMissing.irregular_methods.size.should eql(4)
|
7
13
|
|
@@ -20,4 +26,5 @@ describe "IrregularMethod" do
|
|
20
26
|
u.method_missing.nothing_test.should eql('mm2 found: nothing')
|
21
27
|
|
22
28
|
end
|
29
|
+
|
23
30
|
end
|
data/spec/schema.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -7,6 +7,7 @@ require 'spec'
|
|
7
7
|
require 'spec/autorun'
|
8
8
|
require 'models/method_missing'
|
9
9
|
require 'models/user'
|
10
|
+
require 'models/plain_object'
|
10
11
|
|
11
12
|
ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + '/debug.log')
|
12
13
|
ActiveRecord::Base.configurations = YAML::load(IO.read(File.dirname(__FILE__) + '/database.yml'))
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: irregular_method
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Nelson
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-02-
|
12
|
+
date: 2010-02-20 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -22,7 +22,7 @@ dependencies:
|
|
22
22
|
- !ruby/object:Gem::Version
|
23
23
|
version: 1.2.9
|
24
24
|
version:
|
25
|
-
description: Writing a bunch of case statements to handle regular expressions in method missing is just plain annoying. I suggest they get separated out and defined as their own methods. Well... ruby doesn't really let that happen,
|
25
|
+
description: Writing a bunch of case statements to handle regular expressions in method missing is just plain annoying. I suggest they get separated out and defined as their own methods. Well... ruby doesn't really let that happen, so this is the alternative.
|
26
26
|
email: mdnelson30@gmail.com
|
27
27
|
executables: []
|
28
28
|
|
@@ -42,6 +42,7 @@ files:
|
|
42
42
|
- lib/irregular_method.rb
|
43
43
|
- spec/irregular_method_spec.rb
|
44
44
|
- spec/models/method_missing.rb
|
45
|
+
- spec/models/plain_object.rb
|
45
46
|
- spec/models/user.rb
|
46
47
|
- spec/schema.rb
|
47
48
|
- spec/spec.opts
|
@@ -77,6 +78,7 @@ summary: Method missing is messy. Fix it by defining regular expression methods.
|
|
77
78
|
test_files:
|
78
79
|
- spec/irregular_method_spec.rb
|
79
80
|
- spec/models/method_missing.rb
|
81
|
+
- spec/models/plain_object.rb
|
80
82
|
- spec/models/user.rb
|
81
83
|
- spec/schema.rb
|
82
84
|
- spec/spec_helper.rb
|