not_my_job 0.0.1 → 0.0.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.md +5 -5
- data/not_my_job.gemspec +1 -1
- metadata +1 -1
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
#Not My Job
|
|
1
|
+
# (That's) Not My Job
|
|
2
2
|
|
|
3
|
-
Also known as
|
|
3
|
+
Also known as Empleado Público ;) provides a delegate class method to easily expose contained object's methods as your own.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -23,7 +23,7 @@ $ gem install not_my_job
|
|
|
23
23
|
```
|
|
24
24
|
In order to access the delegate object's methods, NotMyJob creates instance methods for each one specified method.
|
|
25
25
|
|
|
26
|
-
If the delegate object is nil, there are several options: If no block is provided, it will raise
|
|
26
|
+
If the delegate object is nil, there are several options: If no block is provided, it will raise a NoMethodError exception; if the optional code block is specified you may return an alternate value, or to take some arbitrary action.
|
|
27
27
|
|
|
28
28
|
## Examples
|
|
29
29
|
|
|
@@ -67,7 +67,7 @@ restaurant.cuisine_name #=> "Italian"
|
|
|
67
67
|
restaurant.cuisine_chef #=> "Mario"
|
|
68
68
|
```
|
|
69
69
|
|
|
70
|
-
ActiveRecord
|
|
70
|
+
With ActiveRecord associations:
|
|
71
71
|
```ruby
|
|
72
72
|
class Restaurant < ActiveRecord::Base
|
|
73
73
|
extend NotMyJob
|
|
@@ -78,7 +78,7 @@ end
|
|
|
78
78
|
restaurant.place_name #=> "Argentina"
|
|
79
79
|
```
|
|
80
80
|
|
|
81
|
-
If the delegate object is nil and a block is
|
|
81
|
+
If the delegate object is nil and a block is specified:
|
|
82
82
|
```ruby
|
|
83
83
|
class Restaurant
|
|
84
84
|
extend NotMyJob
|
data/not_my_job.gemspec
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Gem::Specification.new do |gem|
|
|
4
4
|
gem.name = "not_my_job"
|
|
5
|
-
gem.version = "0.0.
|
|
5
|
+
gem.version = "0.0.2"
|
|
6
6
|
gem.summary = "Provides a delegate class method to easily expose contained object's methods as your own."
|
|
7
7
|
gem.description = "Provides a delegate class method to easily expose contained object's methods as your own. If an optional code block is specified, then that will be run and its result returned when the delegate object is nil."
|
|
8
8
|
gem.author = "Alfredo Ramírez"
|