acts_as_inquirable 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,8 @@
1
+ == Example
2
+
3
+ class Person < ActiveRecord::Base
4
+ acts_as_inquirable :status
5
+ end
6
+
7
+ person = Person.new(:status => "pending")
8
+ person.status.pending? # true
@@ -0,0 +1,21 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = "acts_as_inquirable"
3
+ s.version = "0.0.1"
4
+ s.date = "2009-03-09"
5
+ s.summary = "A helper to wrap an ActiveRecord attribute with ActiveSupport::StringInquirer."
6
+ s.email = "carlosparamio@gmail.com"
7
+ s.homepage = "http://github.com/carlosparamio/acts_as_inquirable/"
8
+ s.description = "A helper to wrap an ActiveRecord attribute with ActiveSupport::StringInquirer."
9
+ s.authors = ["Carlos Paramio"]
10
+
11
+ s.files = [
12
+ "README.rdoc",
13
+ "acts_as_inquirable.gemspec",
14
+ "lib/active_record/acts/inquirable.rb"
15
+ ]
16
+
17
+ s.add_dependency("activesupport", [">= 2.2.0"])
18
+
19
+ s.has_rdoc = false
20
+ s.rdoc_options = ["--main", "README.rdoc"]
21
+ end
@@ -0,0 +1,15 @@
1
+ module ActiveRecord
2
+ module Acts
3
+ module Inquirable
4
+ def acts_as_inquirable(*args)
5
+ args.each do |name|
6
+ class_eval %{
7
+ def #{name}
8
+ ActiveSupport::StringInquirer.new read_attribute(:#{name}).to_s
9
+ end
10
+ }
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
metadata ADDED
@@ -0,0 +1,67 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: acts_as_inquirable
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Carlos Paramio
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-03-09 00:00:00 +01:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: activesupport
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 2.2.0
24
+ version:
25
+ description: A helper to wrap an ActiveRecord attribute with ActiveSupport::StringInquirer.
26
+ email: carlosparamio@gmail.com
27
+ executables: []
28
+
29
+ extensions: []
30
+
31
+ extra_rdoc_files: []
32
+
33
+ files:
34
+ - README.rdoc
35
+ - acts_as_inquirable.gemspec
36
+ - lib/active_record/acts/inquirable.rb
37
+ has_rdoc: true
38
+ homepage: http://github.com/carlosparamio/acts_as_inquirable/
39
+ licenses: []
40
+
41
+ post_install_message:
42
+ rdoc_options:
43
+ - --main
44
+ - README.rdoc
45
+ require_paths:
46
+ - lib
47
+ required_ruby_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ version: "0"
52
+ version:
53
+ required_rubygems_version: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: "0"
58
+ version:
59
+ requirements: []
60
+
61
+ rubyforge_project:
62
+ rubygems_version: 1.3.5
63
+ signing_key:
64
+ specification_version: 3
65
+ summary: A helper to wrap an ActiveRecord attribute with ActiveSupport::StringInquirer.
66
+ test_files: []
67
+