included-in 0.1.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.tar.gz.sig +0 -0
- data/Manifest +6 -0
- data/README.rdoc +41 -0
- data/Rakefile +14 -0
- data/included-in.gemspec +31 -0
- data/init.rb +1 -0
- data/lib/included_in.rb +13 -0
- metadata +100 -0
- metadata.gz.sig +3 -0
data.tar.gz.sig
ADDED
Binary file
|
data/Manifest
ADDED
data/README.rdoc
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
= Included In
|
2
|
+
|
3
|
+
Rails gem that adds an included_in? method to Object for a more readable syntax of include?
|
4
|
+
|
5
|
+
== Install
|
6
|
+
|
7
|
+
As a gem (with Bundler)
|
8
|
+
|
9
|
+
gem "jaredonline-included-in", :git => "git://github.com/jaredonline/included-in.git"
|
10
|
+
|
11
|
+
As a plugin (Rails 2.3.x)
|
12
|
+
|
13
|
+
script/plugin install git://github.com/jaredonline/included-in.git
|
14
|
+
|
15
|
+
As a plugin (Rails 3.x)
|
16
|
+
|
17
|
+
rails plugin install git://github.com/jaredonline/included-in.git
|
18
|
+
|
19
|
+
== Usage
|
20
|
+
|
21
|
+
If you have an object, say a String, "test" and you want to check for its inclusion in an array, ["test", "jack", "Three"], without using Included-In your code would look like
|
22
|
+
|
23
|
+
str = "test"
|
24
|
+
arr = ["test", "jack", "Three"]
|
25
|
+
|
26
|
+
if arr.include?("test")
|
27
|
+
# do something...
|
28
|
+
else
|
29
|
+
# do something else...
|
30
|
+
end
|
31
|
+
|
32
|
+
It reads "If the array contains this string", when the real question is, "If the string is included in the array". The first sentence puts the importance on the array, the second is more concerned with the string. With Included-In it would look like
|
33
|
+
|
34
|
+
str = "test"
|
35
|
+
arr = ["test", "jack", "Three"]
|
36
|
+
|
37
|
+
if str.included_in?(arr)
|
38
|
+
# do something...
|
39
|
+
else
|
40
|
+
# do something else...
|
41
|
+
end
|
data/Rakefile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
require 'echoe'
|
4
|
+
|
5
|
+
Echoe.new('included-in', '0.1.0') do |p|
|
6
|
+
p.description = "Adds an included_in? method to Object for a more readable syntax of include?"
|
7
|
+
p.url = "https://github.com/jaredonline/included-in"
|
8
|
+
p.author = "Jared McFarland"
|
9
|
+
p.email = "jared.online@gmail.com"
|
10
|
+
p.ignore_pattern = ["tmp/*", "script/*"]
|
11
|
+
p.development_dependencies = []
|
12
|
+
end
|
13
|
+
|
14
|
+
Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext }
|
data/included-in.gemspec
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{included-in}
|
5
|
+
s.version = "0.1.0"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Jared McFarland"]
|
9
|
+
s.cert_chain = ["/Users/jared/gems/keys/gem-public_cert.pem"]
|
10
|
+
s.date = %q{2011-04-13}
|
11
|
+
s.description = %q{Adds an included_in? method to Object for a more readable syntax of include?}
|
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", "included-in.gemspec", "init.rb", "lib/included_in.rb", "Manifest"]
|
15
|
+
s.homepage = %q{https://github.com/jaredonline/included-in}
|
16
|
+
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Included-in", "--main", "README.rdoc"]
|
17
|
+
s.require_paths = ["lib"]
|
18
|
+
s.rubyforge_project = %q{included-in}
|
19
|
+
s.rubygems_version = %q{1.6.0}
|
20
|
+
s.signing_key = %q{/Users/jared/gems/keys/gem-private_key.pem}
|
21
|
+
s.summary = %q{Adds an included_in? method to Object for a more readable syntax of include?}
|
22
|
+
|
23
|
+
if s.respond_to? :specification_version then
|
24
|
+
s.specification_version = 3
|
25
|
+
|
26
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
27
|
+
else
|
28
|
+
end
|
29
|
+
else
|
30
|
+
end
|
31
|
+
end
|
data/init.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'included_in'
|
data/lib/included_in.rb
ADDED
metadata
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: included-in
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Jared McFarland
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain:
|
17
|
+
- |
|
18
|
+
-----BEGIN CERTIFICATE-----
|
19
|
+
MIIDOjCCAiKgAwIBAgIBADANBgkqhkiG9w0BAQUFADBDMRUwEwYDVQQDDAxqYXJl
|
20
|
+
ZC5vbmxpbmUxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkW
|
21
|
+
A2NvbTAeFw0xMTA0MTQwMDAzMzhaFw0xMjA0MTMwMDAzMzhaMEMxFTATBgNVBAMM
|
22
|
+
DGphcmVkLm9ubGluZTEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPy
|
23
|
+
LGQBGRYDY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyquUkmhF
|
24
|
+
Kkznbm9xaTnc9IUQ4aumXVaMNDcjffl5B1ERRmDAuc7RxQjExalTsDemHYJ2yE2V
|
25
|
+
xs7hdSY/86T0SMrFrmGaBfCkhbMxXngpQCnue3b1cjOZRuYlh/Y6etX+eN44H/RD
|
26
|
+
RICzaKC5UQ1vzGqhJIBEsOEwmRkTptsKjOujtmgpNkm5SenW+MgZmu2nupQrXdYu
|
27
|
+
hy9ox0hDBZ85HliY10sKLjcUv6VcR0AH8o9Iq5IiOdbe5OScMa4PtQPXfW+9k7pM
|
28
|
+
YJEKFvzZqQP0E0RfLi0DSKPGWpf0SKx2rJAGRKOlJEBAm3qN/+nBp1rwWjztaLeU
|
29
|
+
bfE/BUPnKalVXQIDAQABozkwNzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNV
|
30
|
+
HQ4EFgQU1iBt/PMdBsIPZB0vzJS0j7RZlZIwDQYJKoZIhvcNAQEFBQADggEBAMW9
|
31
|
+
3phsUJqbGgeELAp7kWWLA+gVT7POR2Nplgl1x5R9a8Sc3KMRcpV0XLJs7JTWZllO
|
32
|
+
sQt7f0EF/bg8o8ezgYY5obl2VqkVReHEnD2pCRHKtE+OTXPf/iEE0BxDMQMygoFp
|
33
|
+
2x1oj96EK8ahXH+ht41AwU0dy8cZuRdJiD50uHqZ0FKFw3CIJp7gfP+/PKa9Ntde
|
34
|
+
KAlFxKAH5xxZ1wwQ8iW1Js1q/O55N39du0hYr16MgReGEZYtz+9ZxxQjUPk+l2GQ
|
35
|
+
VwspOHTCcSz0c4/atDw9so1t3wx6RVPupYV2wV6SR3VJydyugwPTYQ2+WYI+3Abi
|
36
|
+
2cOB2Q53eVtuIblKY2A=
|
37
|
+
-----END CERTIFICATE-----
|
38
|
+
|
39
|
+
date: 2011-04-13 00:00:00 -07:00
|
40
|
+
default_executable:
|
41
|
+
dependencies: []
|
42
|
+
|
43
|
+
description: Adds an included_in? method to Object for a more readable syntax of include?
|
44
|
+
email: jared.online@gmail.com
|
45
|
+
executables: []
|
46
|
+
|
47
|
+
extensions: []
|
48
|
+
|
49
|
+
extra_rdoc_files:
|
50
|
+
- README.rdoc
|
51
|
+
- lib/included_in.rb
|
52
|
+
files:
|
53
|
+
- README.rdoc
|
54
|
+
- Rakefile
|
55
|
+
- included-in.gemspec
|
56
|
+
- init.rb
|
57
|
+
- lib/included_in.rb
|
58
|
+
- Manifest
|
59
|
+
has_rdoc: true
|
60
|
+
homepage: https://github.com/jaredonline/included-in
|
61
|
+
licenses: []
|
62
|
+
|
63
|
+
post_install_message:
|
64
|
+
rdoc_options:
|
65
|
+
- --line-numbers
|
66
|
+
- --inline-source
|
67
|
+
- --title
|
68
|
+
- Included-in
|
69
|
+
- --main
|
70
|
+
- README.rdoc
|
71
|
+
require_paths:
|
72
|
+
- lib
|
73
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
hash: 3
|
79
|
+
segments:
|
80
|
+
- 0
|
81
|
+
version: "0"
|
82
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ">="
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
hash: 11
|
88
|
+
segments:
|
89
|
+
- 1
|
90
|
+
- 2
|
91
|
+
version: "1.2"
|
92
|
+
requirements: []
|
93
|
+
|
94
|
+
rubyforge_project: included-in
|
95
|
+
rubygems_version: 1.6.0
|
96
|
+
signing_key:
|
97
|
+
specification_version: 3
|
98
|
+
summary: Adds an included_in? method to Object for a more readable syntax of include?
|
99
|
+
test_files: []
|
100
|
+
|
metadata.gz.sig
ADDED