acts_as_ally 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 166b65c746523ac36ab7974ba389ede1de8582b3
4
+ data.tar.gz: 634ba9949f578af08f590bffabc03329b9b84e3a
5
+ SHA512:
6
+ metadata.gz: 99fbdaf2cf7d700d877ff548c9d9b3a25a2d5aebd72152fbafde69f4f6166074d4836fed8d4f4d85fd1ae0e053ec16d046a9b8cb5e3030285dc121772be0c95a
7
+ data.tar.gz: 343100b0a4ce84bac38ea8fb5cf10924792a2a6747acae172d38ec8aab03c07d371de03658e3053c6ffb4800bdd3cc710e8227888fe92fba006be543df22a37b
@@ -0,0 +1,35 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /test/tmp/
9
+ /test/version_tmp/
10
+ /tmp/
11
+
12
+ ## Specific to RubyMotion:
13
+ .dat*
14
+ .repl_history
15
+ build/
16
+
17
+ ## Documentation cache and generated files:
18
+ /.yardoc/
19
+ /_yardoc/
20
+ /doc/
21
+ /rdoc/
22
+
23
+ ## Environment normalisation:
24
+ /.bundle/
25
+ /lib/bundler/man/
26
+
27
+ # for a library or gem, you might want to ignore these files since the code is
28
+ # intended to run in multiple environments; otherwise, check them in:
29
+ # Gemfile.lock
30
+ # .ruby-version
31
+ # .ruby-gemset
32
+
33
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
34
+ .rvmrc
35
+ .bundle\n
@@ -0,0 +1,12 @@
1
+ # Contributor Code of Conduct
2
+ ## Version 0.4
3
+
4
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
5
+
6
+ If any participant in this project has issues or takes exception with a contribution, they are obligated to provide constructive feedback and never resort to personal attacks, trolling, public or private harrassment, insults, or other unprofessional conduct.
7
+
8
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
9
+
10
+ Instances of abusive, harrassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
11
+
12
+ We promise to extend courtesy and respect to everyone involved in this project regardless of gender, gender identity, sexual orientation, ability or disability, ethnicity, religion, or level of experience.
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
@@ -0,0 +1,27 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ acts_as_ally (0.0.1)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ diff-lcs (1.2.5)
10
+ rake (10.3.1)
11
+ rspec (2.14.1)
12
+ rspec-core (~> 2.14.0)
13
+ rspec-expectations (~> 2.14.0)
14
+ rspec-mocks (~> 2.14.0)
15
+ rspec-core (2.14.8)
16
+ rspec-expectations (2.14.5)
17
+ diff-lcs (>= 1.1.3, < 2.0)
18
+ rspec-mocks (2.14.6)
19
+
20
+ PLATFORMS
21
+ ruby
22
+
23
+ DEPENDENCIES
24
+ acts_as_ally!
25
+ bundler (~> 1.6)
26
+ rake
27
+ rspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 Coraline Ada Ehmke
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,55 @@
1
+ acts_as_ally
2
+ ============
3
+
4
+ Allows a Rails model to behave like an ally, maybe.
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ gem 'acts_as_ally'
11
+
12
+ And then execute:
13
+
14
+ $ bundle
15
+
16
+ Or install it yourself as:
17
+
18
+ $ gem install acts_as_ally
19
+
20
+ ## Usage
21
+
22
+ In your model:
23
+
24
+ class Man < ActiveRecord::Base
25
+ include ActsAsAlly
26
+ end
27
+
28
+ In console:
29
+
30
+ 2.1.1 :001 > Man.count
31
+ (0.2ms) SELECT COUNT(*) FROM "men"
32
+ => 10
33
+
34
+ 2.1.1 :002 > Man.not_all
35
+ (0.1ms) SELECT COUNT(*) FROM "men"
36
+ Man Load (0.1ms) SELECT "men".* FROM "men" LIMIT 1
37
+ => [#<Man id: 1, created_at: "2014-04-28 23:22:02", updated_at: "2014-04-28 23:22:02">]
38
+
39
+ 2.1.1 :003 > Man.not_all.first.cookies
40
+ Man Load (0.2ms) SELECT "men".* FROM "men"
41
+ (0.1ms) SELECT COUNT(*) FROM "men"
42
+ => []
43
+
44
+ ## You Might Also Like
45
+
46
+ If you find this gem useful, check out [WellActually](https://github.com/bantik/well_actually)
47
+
48
+ ## Contributing
49
+
50
+ 1. Fork it ( https://github.com/[my-github-username]/acts_as_ally/fork )
51
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
52
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
53
+ 4. Push to the branch (`git push origin my-new-feature`)
54
+ 5. Create a new Pull Request
55
+
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'acts_as_ally/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "acts_as_ally"
8
+ spec.version = ActsAsAlly::VERSION
9
+ spec.authors = ["Bantik"]
10
+ spec.email = ["coraline@idolhands.com"]
11
+ spec.summary = %q{Allows a Rails model to behave like an ally, maybe.}
12
+ spec.description = %q{Allows a Rails model to behave like an ally, maybe.}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.6"
22
+ spec.add_development_dependency "rake"
23
+ end
@@ -0,0 +1,20 @@
1
+ require "acts_as_ally/version"
2
+
3
+ module ActsAsAlly
4
+
5
+ def self.included(klass)
6
+ klass.extend ClassMethods
7
+ klass.send(:attr_writer, :cookies)
8
+ end
9
+
10
+ def cookies
11
+ @cookies ||= []
12
+ end
13
+
14
+ module ClassMethods
15
+ def not_all
16
+ limit([(count * 0.05).to_i, 1].max)
17
+ end
18
+ end
19
+
20
+ end
@@ -0,0 +1,3 @@
1
+ module ActsAsAlly
2
+ VERSION = "1.0.0"
3
+ end
metadata ADDED
@@ -0,0 +1,83 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: acts_as_ally
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Bantik
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-04-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.6'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: Allows a Rails model to behave like an ally, maybe.
42
+ email:
43
+ - coraline@idolhands.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - CODE_OF_CONDUCT.md
50
+ - Gemfile
51
+ - Gemfile.lock
52
+ - LICENSE
53
+ - README.md
54
+ - Rakefile
55
+ - acts_as_ally.gemspec
56
+ - lib/acts_as_ally.rb
57
+ - lib/acts_as_ally/version.rb
58
+ homepage: ''
59
+ licenses:
60
+ - MIT
61
+ metadata: {}
62
+ post_install_message:
63
+ rdoc_options: []
64
+ require_paths:
65
+ - lib
66
+ required_ruby_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ requirements: []
77
+ rubyforge_project:
78
+ rubygems_version: 2.2.2
79
+ signing_key:
80
+ specification_version: 4
81
+ summary: Allows a Rails model to behave like an ally, maybe.
82
+ test_files: []
83
+ has_rdoc: