irregular_method 0.1.3 → 0.2.0

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 CHANGED
@@ -7,10 +7,6 @@ Writing a bunch of case statements to handle regular expressions in method missi
7
7
  Install the gem
8
8
  gem install irregular_method
9
9
 
10
- Add it to your environment.rb
11
-
12
- config.gem 'irregular_method'
13
-
14
10
  == Usage
15
11
 
16
12
  The purpose of irregular_method is to allow methods with regular expression names to be defined. To do so, simply define a method using the reg_def command.
@@ -24,7 +20,8 @@ The purpose of irregular_method is to allow methods with regular expression name
24
20
  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
21
 
26
22
  class Layer
27
-
23
+ include ::Irregular::Method
24
+
28
25
  cattr_accessor :layers
29
26
  attr_accessible :index
30
27
 
@@ -38,7 +35,8 @@ What this is doing is matching a method looking like "layer_XXX". If the match (
38
35
  What's nice about this is you no longer need to write a bunch of messy code in your method_missing. Instead, write it as reg_def's and have a cleaner definition of your class. Let's take a look at one more example:
39
36
 
40
37
  class Example < ActiveRecord::Base
41
-
38
+ include ::Irregular::Method
39
+
42
40
  has_many :users
43
41
  has_many :cars
44
42
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.3
1
+ 0.2.0
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{irregular_method}
8
- s.version = "0.1.3"
8
+ s.version = "0.2.0"
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-20}
12
+ s.date = %q{2010-03-15}
13
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 = [
@@ -36,7 +36,7 @@ Gem::Specification.new do |s|
36
36
  s.homepage = %q{http://github.com/mnelson/irregular_method}
37
37
  s.rdoc_options = ["--charset=UTF-8"]
38
38
  s.require_paths = ["lib"]
39
- s.rubygems_version = %q{1.3.5}
39
+ s.rubygems_version = %q{1.3.6}
40
40
  s.summary = %q{Method missing is messy. Fix it by defining regular expression methods.}
41
41
  s.test_files = [
42
42
  "spec/irregular_method_spec.rb",
@@ -39,8 +39,8 @@ module Irregular
39
39
  super(name, *args)
40
40
  end
41
41
 
42
- def respond_to?(method_name)
43
- result = super(method_name)
42
+ def respond_to?(method_name, include_private = false)
43
+ result = super(method_name, include_private)
44
44
  if !result
45
45
  method_id = method_name.to_s
46
46
  irregular_methods && irregular_methods.each do |context|
@@ -7,6 +7,10 @@ describe "IrregularMethod" do
7
7
  p.important_really_awesome_things.should eql("Plain Object's say things like: really_awesome_things")
8
8
  end
9
9
 
10
+ it "should allow private methods to be checked" do
11
+ lambda { PlainObject.new.respond_to?(:something, true) }.should_not raise_error
12
+ end
13
+
10
14
  it "should implement and bind reg_def properly" do
11
15
  mm = MethodMissing.create(:name => 'mm1')
12
16
  MethodMissing.irregular_methods.size.should eql(4)
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: irregular_method
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 2
8
+ - 0
9
+ version: 0.2.0
5
10
  platform: ruby
6
11
  authors:
7
12
  - Mike Nelson
@@ -9,19 +14,23 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2010-02-20 00:00:00 -05:00
17
+ date: 2010-03-15 00:00:00 -04:00
13
18
  default_executable:
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
21
  name: rspec
17
- type: :development
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
20
24
  requirements:
21
25
  - - ">="
22
26
  - !ruby/object:Gem::Version
27
+ segments:
28
+ - 1
29
+ - 2
30
+ - 9
23
31
  version: 1.2.9
24
- version:
32
+ type: :development
33
+ version_requirements: *id001
25
34
  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
35
  email: mdnelson30@gmail.com
27
36
  executables: []
@@ -60,18 +69,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
60
69
  requirements:
61
70
  - - ">="
62
71
  - !ruby/object:Gem::Version
72
+ segments:
73
+ - 0
63
74
  version: "0"
64
- version:
65
75
  required_rubygems_version: !ruby/object:Gem::Requirement
66
76
  requirements:
67
77
  - - ">="
68
78
  - !ruby/object:Gem::Version
79
+ segments:
80
+ - 0
69
81
  version: "0"
70
- version:
71
82
  requirements: []
72
83
 
73
84
  rubyforge_project:
74
- rubygems_version: 1.3.5
85
+ rubygems_version: 1.3.6
75
86
  signing_key:
76
87
  specification_version: 3
77
88
  summary: Method missing is messy. Fix it by defining regular expression methods.