validates_truthiness 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ pkg/*
2
+ *.gem
3
+ .bundle
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in validates_truthiness.gemspec
4
+ gemspec
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,3 @@
1
+ module ValidatesTruthiness
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,15 @@
1
+ module ActiveModel
2
+ module Validations
3
+ class TruthinessValidator < ActiveModel::EachValidator
4
+ def validate_each(record, attribute, value)
5
+ record.errors[attribute] << "must be either True or False" unless (value.is_a?(FalseClass) || value.is_a?(TrueClass))
6
+ end
7
+ end
8
+
9
+ module HelperMethods
10
+ def validates_truthiness_of(*attr_names)
11
+ validates_with TruthinessValidator, _merge_attributes(attr_names)
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "validates_truthiness/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "validates_truthiness"
7
+ s.version = ValidatesTruthiness::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["jfelchner", "thekompanee"]
10
+ s.email = ["support@thekompanee.com"]
11
+ s.homepage = "https://github.com/jfelchner/validates_truthiness"
12
+ s.summary = %q[validates_truthiness-#{ValidatesTruthiness::VERSION}]
13
+ s.description = %q[Makes boolean validations a little cleaner.]
14
+
15
+ s.rubyforge_project = "validates_truthiness"
16
+
17
+ s.files = `git ls-files`.split("\n")
18
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
+ s.require_paths = ["lib"]
21
+ end
metadata ADDED
@@ -0,0 +1,71 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: validates_truthiness
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 1
9
+ version: 0.0.1
10
+ platform: ruby
11
+ authors:
12
+ - jfelchner
13
+ - thekompanee
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-01-30 00:00:00 -06:00
19
+ default_executable:
20
+ dependencies: []
21
+
22
+ description: Makes boolean validations a little cleaner.
23
+ email:
24
+ - support@thekompanee.com
25
+ executables: []
26
+
27
+ extensions: []
28
+
29
+ extra_rdoc_files: []
30
+
31
+ files:
32
+ - .gitignore
33
+ - Gemfile
34
+ - Rakefile
35
+ - lib/validates_truthiness.rb
36
+ - lib/validates_truthiness/version.rb
37
+ - validates_truthiness.gemspec
38
+ has_rdoc: true
39
+ homepage: https://github.com/jfelchner/validates_truthiness
40
+ licenses: []
41
+
42
+ post_install_message:
43
+ rdoc_options: []
44
+
45
+ require_paths:
46
+ - lib
47
+ required_ruby_version: !ruby/object:Gem::Requirement
48
+ none: false
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ segments:
53
+ - 0
54
+ version: "0"
55
+ required_rubygems_version: !ruby/object:Gem::Requirement
56
+ none: false
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ segments:
61
+ - 0
62
+ version: "0"
63
+ requirements: []
64
+
65
+ rubyforge_project: validates_truthiness
66
+ rubygems_version: 1.3.7
67
+ signing_key:
68
+ specification_version: 3
69
+ summary: validates_truthiness-#{ValidatesTruthiness::VERSION}
70
+ test_files: []
71
+