scrivener 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -100,7 +100,7 @@ Now see what happens with Scrivener:
100
100
  attr_accessor :status
101
101
 
102
102
  def validate
103
- assert_format /^(published|draft)$/
103
+ assert_format :status, /^(published|draft)$/
104
104
  end
105
105
  end
106
106
 
@@ -1,7 +1,7 @@
1
1
  require File.expand_path("scrivener/validations", File.dirname(__FILE__))
2
2
 
3
3
  class Scrivener
4
- VERSION = "0.0.1"
4
+ VERSION = "0.0.2"
5
5
 
6
6
  include Validations
7
7
 
@@ -47,6 +47,8 @@ class Scrivener
47
47
  def attributes
48
48
  Hash.new.tap do |atts|
49
49
  instance_variables.each do |ivar|
50
+ next if ivar == :@errors
51
+
50
52
  att = ivar.to_s.sub(/@/, "").to_sym
51
53
  atts[att] = send(att)
52
54
  end
@@ -57,6 +57,15 @@ scope do
57
57
  assert_equal [], t.errors[:a]
58
58
  assert_equal [:not_present], t.errors[:b]
59
59
  end
60
+
61
+ test "attributes without @errors" do
62
+ atts = { :a => 1, :b => 2 }
63
+
64
+ t = T.new(atts)
65
+
66
+ t.valid?
67
+ assert_equal atts, t.attributes
68
+ end
60
69
  end
61
70
 
62
71
  class Quote
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scrivener
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,12 +9,12 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-10-18 00:00:00.000000000 -03:00
12
+ date: 2011-10-24 00:00:00.000000000 -03:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: cutest
17
- requirement: &2154104200 !ruby/object:Gem::Requirement
17
+ requirement: &2156684860 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,7 +22,7 @@ dependencies:
22
22
  version: '0'
23
23
  type: :development
24
24
  prerelease: false
25
- version_requirements: *2154104200
25
+ version_requirements: *2156684860
26
26
  description: Scrivener removes the validation responsibility from models and acts
27
27
  as a filter for whitelisted attributes.
28
28
  email: