included-in 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/CHANGELOG +3 -0
- data/Manifest +3 -1
- data/README.rdoc +6 -4
- data/Rakefile +1 -1
- data/included-in.gemspec +3 -3
- data/lib/included_in.rb +1 -13
- data/lib/included_in/object.rb +1 -0
- data/lib/included_in/object/inclusion.rb +14 -0
- metadata +25 -19
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGELOG
ADDED
data/Manifest
CHANGED
data/README.rdoc
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
= Included In
|
2
2
|
|
3
|
-
Rails gem that adds an
|
3
|
+
Rails gem that adds an in? method to Object for a more readable syntax of include?
|
4
|
+
|
5
|
+
Mimics the functionality of ActiveSupport 3.1
|
4
6
|
|
5
7
|
== Install
|
6
8
|
|
7
9
|
As a gem (with Bundler)
|
8
10
|
|
9
|
-
gem "
|
10
|
-
|
11
|
+
gem "included-in", :require => "included_in"
|
12
|
+
|
11
13
|
As a plugin (Rails 2.3.x)
|
12
14
|
|
13
15
|
script/plugin install git://github.com/jaredonline/included-in.git
|
@@ -34,7 +36,7 @@ It reads "If the array contains this string", when the real question is, "If the
|
|
34
36
|
str = "test"
|
35
37
|
arr = ["test", "jack", "Three"]
|
36
38
|
|
37
|
-
if str.
|
39
|
+
if str.in?(arr)
|
38
40
|
# do something...
|
39
41
|
else
|
40
42
|
# do something else...
|
data/Rakefile
CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
require 'rake'
|
3
3
|
require 'echoe'
|
4
4
|
|
5
|
-
Echoe.new('included-in', '0.
|
5
|
+
Echoe.new('included-in', '0.2.0') do |p|
|
6
6
|
p.description = "Adds an included_in? method to Object for a more readable syntax of include?"
|
7
7
|
p.url = "https://github.com/jaredonline/included-in"
|
8
8
|
p.author = "Jared McFarland"
|
data/included-in.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{included-in}
|
5
|
-
s.version = "0.
|
5
|
+
s.version = "0.2.0"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Jared McFarland"]
|
@@ -10,8 +10,8 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.date = %q{2011-04-13}
|
11
11
|
s.description = %q{Adds an included_in? method to Object for a more readable syntax of include?}
|
12
12
|
s.email = %q{jared.online@gmail.com}
|
13
|
-
s.extra_rdoc_files = ["README.rdoc", "lib/included_in.rb"]
|
14
|
-
s.files = ["README.rdoc", "Rakefile", "
|
13
|
+
s.extra_rdoc_files = ["CHANGELOG", "README.rdoc", "lib/included_in.rb", "lib/included_in/object.rb", "lib/included_in/object/inclusion.rb"]
|
14
|
+
s.files = ["CHANGELOG", "README.rdoc", "Rakefile", "init.rb", "lib/included_in.rb", "lib/included_in/object.rb", "lib/included_in/object/inclusion.rb", "Manifest", "included-in.gemspec"]
|
15
15
|
s.homepage = %q{https://github.com/jaredonline/included-in}
|
16
16
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Included-in", "--main", "README.rdoc"]
|
17
17
|
s.require_paths = ["lib"]
|
data/lib/included_in.rb
CHANGED
@@ -1,13 +1 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
def included_in?(object)
|
4
|
-
raise ArgumentError.new("You must supply an argument that responds to include?") unless object.respond_to?(:include?)
|
5
|
-
|
6
|
-
object.include?(self)
|
7
|
-
end
|
8
|
-
|
9
|
-
end
|
10
|
-
|
11
|
-
class Object
|
12
|
-
include IncludedIn
|
13
|
-
end
|
1
|
+
require 'included_in/object'
|
@@ -0,0 +1 @@
|
|
1
|
+
require "included_in/object/inclusion.rb"
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class Object
|
2
|
+
|
3
|
+
def in?(object)
|
4
|
+
raise ArgumentError.new("You must supply an argument that responds to include?") unless object.respond_to?(:include?)
|
5
|
+
|
6
|
+
object.include?(self)
|
7
|
+
end
|
8
|
+
|
9
|
+
def included_in?(object)
|
10
|
+
p "DEPRECATION WARNING: Called Object#included_in?, use Object#in? instead. Called from #{Kernel.caller[0]}"
|
11
|
+
in?(object)
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: included-in
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 2
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.2.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jared McFarland
|
@@ -18,22 +18,22 @@ cert_chain:
|
|
18
18
|
-----BEGIN CERTIFICATE-----
|
19
19
|
MIIDOjCCAiKgAwIBAgIBADANBgkqhkiG9w0BAQUFADBDMRUwEwYDVQQDDAxqYXJl
|
20
20
|
ZC5vbmxpbmUxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkW
|
21
|
-
|
21
|
+
A2NvbTAeFw0xMTA0MTQwMDQxMTBaFw0xMjA0MTMwMDQxMTBaMEMxFTATBgNVBAMM
|
22
22
|
DGphcmVkLm9ubGluZTEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPy
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
23
|
+
LGQBGRYDY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwO6egtCl
|
24
|
+
Ia9gAeVfFqmS1pck6b2wseSZ2ZEHTHmUcqL6apfDdx2tbY2WdTqGiSLmeZXcsFJu
|
25
|
+
yqLTSXpDIZHBYXhKyM1tCdT2lWmCVJFDhhU/R52AIlLDS9QuTorMVGbL1My62U86
|
26
|
+
XFHIw4u9QU4C5dINw9hUF83Q9YZbOgPIeM5eL6HCAFAOxLtkD0Yw5/BOZ2cTfgA0
|
27
|
+
f11Yqkyngi5DwwXxNeb52m6Tp+z6rdcVusiYHdEHJFto9pjbtMeEKQqsz4d7TeVe
|
28
|
+
6sBjxofnako0RNZsNh7RpPa6S7JOZU5QKJuAVPPIb8UVrP1DIihK++9FHYq/kz7h
|
29
|
+
ToJ55ft3J/hA8QIDAQABozkwNzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNV
|
30
|
+
HQ4EFgQUslo275mIRkTWVUpZeQxOsXF9bJkwDQYJKoZIhvcNAQEFBQADggEBAA9h
|
31
|
+
SqgjnidOcpoPjE32HkmDHPqFIsU3/m1W7Np8847TCj4X2gsGrpSEL5dy0Po3cw9E
|
32
|
+
0frKfw/jfUUnggYYvO9m+u0+tuas6GpwdY+Ll8ybtBMWQ4G8Msc9fY7EWZ3Jm/hK
|
33
|
+
8n5gejpuKC/MpF6bDllerHWpHI/d2csuHL339sJVR13tZamifgHm748/ig6/bO/K
|
34
|
+
m1verQa8BF6GC+fpZgfGriyoN8ync3F4wi2T/9koGzio1kotNIWhWtz8Ay/+KppJ
|
35
|
+
VFN1Jwb+Xjp/Jea9EZPL03vBfpTp6Z1OuN3MdRK26SaOBfFRdO/7JfKVdGHLWUPO
|
36
|
+
ncO2Ggxc146uqG0Yz4o=
|
37
37
|
-----END CERTIFICATE-----
|
38
38
|
|
39
39
|
date: 2011-04-13 00:00:00 -07:00
|
@@ -47,15 +47,21 @@ executables: []
|
|
47
47
|
extensions: []
|
48
48
|
|
49
49
|
extra_rdoc_files:
|
50
|
+
- CHANGELOG
|
50
51
|
- README.rdoc
|
51
52
|
- lib/included_in.rb
|
53
|
+
- lib/included_in/object.rb
|
54
|
+
- lib/included_in/object/inclusion.rb
|
52
55
|
files:
|
56
|
+
- CHANGELOG
|
53
57
|
- README.rdoc
|
54
58
|
- Rakefile
|
55
|
-
- included-in.gemspec
|
56
59
|
- init.rb
|
57
60
|
- lib/included_in.rb
|
61
|
+
- lib/included_in/object.rb
|
62
|
+
- lib/included_in/object/inclusion.rb
|
58
63
|
- Manifest
|
64
|
+
- included-in.gemspec
|
59
65
|
has_rdoc: true
|
60
66
|
homepage: https://github.com/jaredonline/included-in
|
61
67
|
licenses: []
|
metadata.gz.sig
CHANGED
Binary file
|