scriba 0.0.1.alpha2 → 0.0.1.alpha3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dc46acaf0eb146741ee1eab5e2465410dc6dae8d
4
- data.tar.gz: 7686ab4fd5581a0536b38e3979bb3bd0473195cb
3
+ metadata.gz: 66228de723806bb775ac7fbca0cddf365587d0c4
4
+ data.tar.gz: 9259d1cf49d3fef29edc51161318d4c8bc2e8d28
5
5
  SHA512:
6
- metadata.gz: c4bf2701fd0b99e60045d59726b086cd8d29e4fd80a0acc14a2c4b9728feca5d5fc6217172aca9f51e50496478c9e0d4270e10bb0c15ef57488d5cbcfedd85f7
7
- data.tar.gz: 0fb347174d7e93a78942cbbde070b8173f0c4e75248e0e74fbc1ae34e9bfa36801e69cacdbbde1bd08ccf8e57a14b4c7552c24d13e764d551935f6ff82ef703c
6
+ metadata.gz: 7135a3ab4453b1132e7f9dd3e4cd29eb6dfd8df9fc57f9698cc13cc84cc06ea7f4b5a528b7ac75cfd9dfecf82d597e0b89091196e44662537ac9959a1477778c
7
+ data.tar.gz: 79e7a80d8b594c2eeb090e469f53c7e4f5e5bfccd741562056bd2dfcb17e658c0e548b0c1ba820533acc7cb23049bc89c1435544e438ad2431d20f9a0c7c3f0f
@@ -1,6 +1,6 @@
1
1
  module Scriba::PartialUpdate
2
2
  def __attributes
3
- @_attributes ||= @_updates.keys.map(&:to_sym)
3
+ @_attributes ||= super & updates.keys.map(&:to_sym)
4
4
  end
5
5
 
6
6
  def assert(value, att, options = {})
data/lib/scriba.rb CHANGED
@@ -19,8 +19,10 @@ class Scriba
19
19
  @attributes ||= []
20
20
  end
21
21
 
22
+ attr :updates
23
+
22
24
  def initialize(updates = {})
23
- update(@_updates = updates)
25
+ update(@updates = updates)
24
26
  end
25
27
 
26
28
  def update(updates)
data/scriba.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "scriba"
3
- s.version = "0.0.1.alpha2"
3
+ s.version = "0.0.1.alpha3"
4
4
  s.summary = "Validation frontend for models."
5
5
  s.description = s.summary + " Inspired by the scrivener gem."
6
6
  s.authors = ["Francesco Rodríguez"]
data/test/partial.rb CHANGED
@@ -19,6 +19,13 @@ test "return only passed attributes" do
19
19
  assert_equal(attrs, signup.attributes)
20
20
  end
21
21
 
22
+ test "ignore extra attributes" do
23
+ attrs = { username: "me" }
24
+ signup = Signup.new(attrs.merge(undefined: true))
25
+
26
+ assert_equal(attrs, signup.attributes)
27
+ end
28
+
22
29
  test "validate given attributes" do
23
30
  attrs = { username: "" }
24
31
  signup = Signup.new(attrs)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scriba
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.alpha2
4
+ version: 0.0.1.alpha3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Francesco Rodríguez