unveil 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile ADDED
@@ -0,0 +1,23 @@
1
+ require 'rake'
2
+ require 'rake/testtask'
3
+ require 'rake/rdoctask'
4
+
5
+ desc 'Default: run unit tests.'
6
+ task :default => :test
7
+
8
+ desc 'Test the unveil plugin.'
9
+ Rake::TestTask.new(:test) do |t|
10
+ t.libs << 'lib'
11
+ t.libs << 'test'
12
+ t.pattern = 'test/**/*_test.rb'
13
+ t.verbose = true
14
+ end
15
+
16
+ desc 'Generate documentation for the unveil plugin.'
17
+ Rake::RDocTask.new(:rdoc) do |rdoc|
18
+ rdoc.rdoc_dir = 'rdoc'
19
+ rdoc.title = 'Unveil'
20
+ rdoc.options << '--line-numbers' << '--inline-source'
21
+ rdoc.rdoc_files.include('README')
22
+ rdoc.rdoc_files.include('lib/**/*.rb')
23
+ end
@@ -0,0 +1,5 @@
1
+ Array.class_eval do
2
+ def unveil
3
+ map &:unveil
4
+ end
5
+ end
data/lib/unveil.rb ADDED
@@ -0,0 +1,23 @@
1
+ require 'unveil/core_ext'
2
+
3
+ module Unveil
4
+ def self.included(base)
5
+ base.send :extend, ClassMethods
6
+ end
7
+
8
+ module ClassMethods
9
+ def unveil(options = {})
10
+ cattr_accessor :unveil_options
11
+ self.unveil_options = options
12
+ send :include, InstanceMethods
13
+ end
14
+ end
15
+
16
+ module InstanceMethods
17
+ def unveil(options = {})
18
+ serializable_hash(self.class.unveil_options.reverse_merge(options))
19
+ end
20
+ end
21
+ end
22
+
23
+ ActiveRecord::Base.send :include, Unveil
@@ -0,0 +1,3 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+ require 'active_support'
@@ -0,0 +1,8 @@
1
+ require 'test_helper'
2
+
3
+ class UnveilTest < ActiveSupport::TestCase
4
+ # Replace this with your real tests.
5
+ test "the truth" do
6
+ assert true
7
+ end
8
+ end
metadata ADDED
@@ -0,0 +1,68 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: unveil
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 1
9
+ version: 0.1.1
10
+ platform: ruby
11
+ authors:
12
+ - Shaun Chapman
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2011-01-13 00:00:00 -05:00
18
+ default_executable:
19
+ dependencies: []
20
+
21
+ description: Unveil provides a super simple way to specify which of a model's attributes are available to an API in a Ruby on Rails application.
22
+ email: shaunchapman@gmail.com
23
+ executables: []
24
+
25
+ extensions: []
26
+
27
+ extra_rdoc_files: []
28
+
29
+ files:
30
+ - Rakefile
31
+ - lib/unveil/core_ext.rb
32
+ - lib/unveil.rb
33
+ - test/test_helper.rb
34
+ - test/unveil_test.rb
35
+ has_rdoc: true
36
+ homepage: http://github.com/shaunchapman/unveil
37
+ licenses: []
38
+
39
+ post_install_message:
40
+ rdoc_options: []
41
+
42
+ require_paths:
43
+ - lib
44
+ required_ruby_version: !ruby/object:Gem::Requirement
45
+ none: false
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ segments:
50
+ - 0
51
+ version: "0"
52
+ required_rubygems_version: !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ segments:
58
+ - 0
59
+ version: "0"
60
+ requirements: []
61
+
62
+ rubyforge_project: unveil
63
+ rubygems_version: 1.3.7
64
+ signing_key:
65
+ specification_version: 3
66
+ summary: Specify what's available to an API
67
+ test_files: []
68
+