arson 0.0.2

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.
Files changed (7) hide show
  1. data.tar.gz.sig +0 -0
  2. data/Manifest +3 -0
  3. data/Rakefile +12 -0
  4. data/arson.gemspec +32 -0
  5. data/lib/arson.rb +38 -0
  6. metadata +92 -0
  7. metadata.gz.sig +1 -0
Binary file
@@ -0,0 +1,3 @@
1
+ Rakefile
2
+ lib/arson.rb
3
+ Manifest
@@ -0,0 +1,12 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'echoe'
4
+
5
+ Echoe.new('arson', '0.0.2') do |p|
6
+ p.description = "Adds active-record validations to a json format (to_arson) so that validations can be performed client side."
7
+ p.url = "http://austinbergstrom.github.com/Arson"
8
+ p.author = "Austin Bergstrom"
9
+ p.email = "awbergs@gmail.com"
10
+ p.ignore_pattern = ["tmp/*", "script/*"]
11
+ p.development_dependencies = []
12
+ end
@@ -0,0 +1,32 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{arson}
5
+ s.version = "0.0.2"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Austin Bergstrom"]
9
+ s.cert_chain = ["/Users/austinbergstrom/proj/gems/gem-public_cert.pem"]
10
+ s.date = %q{2011-02-09}
11
+ s.description = %q{Adds active-record validations to a json format (to_arson) so that validations can be performed client side.}
12
+ s.email = %q{awbergs@gmail.com}
13
+ s.extra_rdoc_files = ["lib/arson.rb"]
14
+ s.files = ["Rakefile", "lib/arson.rb", "Manifest", "arson.gemspec"]
15
+ s.homepage = %q{http://austinbergstrom.github.com/Arson}
16
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Arson", "--main", "README"]
17
+ s.require_paths = ["lib"]
18
+ s.rubyforge_project = %q{arson}
19
+ s.rubygems_version = %q{1.3.6}
20
+ s.signing_key = %q{/Users/austinbergstrom/proj/gems/gem-private_key.pem}
21
+ s.summary = %q{Adds active-record validations to a json format (to_arson) so that validations can be performed client side.}
22
+
23
+ if s.respond_to? :specification_version then
24
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
25
+ s.specification_version = 3
26
+
27
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
28
+ else
29
+ end
30
+ else
31
+ end
32
+ end
@@ -0,0 +1,38 @@
1
+ module Arson
2
+ def self.included(base)
3
+ base.extend(ClassMethods)
4
+ end
5
+ module ClassMethods
6
+ def arson
7
+ class_eval <<-EOC
8
+ @@arson_validations = {}
9
+
10
+ def to_arson(class_name=nil)
11
+ @class_name ||= class_name || self.class.to_s
12
+ self.valid?
13
+ ActiveSupport::JSON.encode({@class_name=>instance_values.update("arson_validations"=>@@arson_validations)})
14
+ end
15
+
16
+ protected
17
+
18
+ def self.validates_presence_of(*attr_names)
19
+ add_arson_validation("presence",attr_names.clone)
20
+ super
21
+ end
22
+
23
+ def self.validates_format_of(*attr_names)
24
+ add_arson_validation("format",attr_names.clone)
25
+ super
26
+ end
27
+
28
+ def self.add_arson_validation(validation, configuration)
29
+ validation_options = configuration.extract_options!
30
+ method = configuration.flatten.to_s
31
+ @@arson_validations[method] ||= []
32
+ @@arson_validations[method] << {validation=>validation_options}
33
+ end
34
+ EOC
35
+ end
36
+ end
37
+ end
38
+ ActiveRecord::Base.send :include, Arson
metadata ADDED
@@ -0,0 +1,92 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: arson
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 2
9
+ version: 0.0.2
10
+ platform: ruby
11
+ authors:
12
+ - Austin Bergstrom
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain:
16
+ - |
17
+ -----BEGIN CERTIFICATE-----
18
+ MIIDMDCCAhigAwIBAgIBADANBgkqhkiG9w0BAQUFADA+MRAwDgYDVQQ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BooP88pYZD60ytZK6zdrb0X8JoZ3rI7YXTMYQHNEKM5Qmr
35
+ hiJQ2w==
36
+ -----END CERTIFICATE-----
37
+
38
+ date: 2011-02-09 00:00:00 -05:00
39
+ default_executable:
40
+ dependencies: []
41
+
42
+ description: Adds active-record validations to a json format (to_arson) so that validations can be performed client side.
43
+ email: awbergs@gmail.com
44
+ executables: []
45
+
46
+ extensions: []
47
+
48
+ extra_rdoc_files:
49
+ - lib/arson.rb
50
+ files:
51
+ - Rakefile
52
+ - lib/arson.rb
53
+ - Manifest
54
+ - arson.gemspec
55
+ has_rdoc: true
56
+ homepage: http://austinbergstrom.github.com/Arson
57
+ licenses: []
58
+
59
+ post_install_message:
60
+ rdoc_options:
61
+ - --line-numbers
62
+ - --inline-source
63
+ - --title
64
+ - Arson
65
+ - --main
66
+ - README
67
+ require_paths:
68
+ - lib
69
+ required_ruby_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ segments:
74
+ - 0
75
+ version: "0"
76
+ required_rubygems_version: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ segments:
81
+ - 1
82
+ - 2
83
+ version: "1.2"
84
+ requirements: []
85
+
86
+ rubyforge_project: arson
87
+ rubygems_version: 1.3.6
88
+ signing_key:
89
+ specification_version: 3
90
+ summary: Adds active-record validations to a json format (to_arson) so that validations can be performed client side.
91
+ test_files: []
92
+
@@ -0,0 +1 @@
1
+ ��*�xu�B:wڲ㲝�b���[H�tK燳H�0;�c��V�݆��q�6�8NRVd��[VS4�����-�:88�g����*�|т�o݂�;+ �f4��nM3P�� �u"Mb>��i�آ�e�|���lsy.d�`����D�W��� �U8�1zǣA���r��V�A`��%��׾�п�-���D:�ꦴ��;�QC-����*�C��n� ��<գ}��(.(�