dolly 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1952fc2428d46ea5090b64c1785e63c2665196e1
4
- data.tar.gz: 365cf7c705ebd578fe5116721a94653a28cca9fc
3
+ metadata.gz: deab5211996013fda5d0ee9e44bf4c6cc1c18d1d
4
+ data.tar.gz: bc5266dbcb192446a7ec0592523b2892a7a388f1
5
5
  SHA512:
6
- metadata.gz: c043052831b7bc395ca53d49771026d1450e409a1bd92dcc2efc45377d4ae63d1cf81ec95ebed62717998308cadfa8f4a12085c43f1bd2e77fc66631d500e7da
7
- data.tar.gz: 0a90e6732e7125a4f835d320c6f6902bff4327f37afd63794789fc4fb8ec0687e30ef638bc1b98dfac1a9ac38fe3388908c90070158cd918b52d275ab8f07d63
6
+ metadata.gz: 9724e760d84370771d39ca241781bcf2d8ee6dad7da8955521bbdc8ddd8e61813d6f2f8f6eb6f3cfe61e93b0219904c3e09c0ffb9811f3a24318f1357cd58b85
7
+ data.tar.gz: 8036a2ac3b9bc801ccc5a342955c49676fff02b60586bd6cf8ba81a1f6c3b2e90d70deb7bfd9e4dfad3ba995dfbe5f3bbb4c241a26c82eb290a65ee2d819a65f
@@ -79,6 +79,10 @@ module Dolly
79
79
  raise Dolly::ResourceNotFound if col.empty?
80
80
  col.each{ |r| @doc = r['doc'] }
81
81
  _properties.each do |p|
82
+ #TODO: Refactor properties so it is not required
83
+ #to be a class property. But something that doesn't
84
+ #persist all the inheretence chain
85
+ next unless self.respond_to? :"#{p.name}="
82
86
  self.send "#{p.name}=", doc[p.name]
83
87
  end
84
88
  @rows = col
data/lib/dolly/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Dolly
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
data/lib/tasks/db.rake CHANGED
@@ -19,10 +19,15 @@ namespace :db do
19
19
  key ||= 'map'
20
20
  source = File.read filename
21
21
 
22
- vd = data[design_doc_name] ||= { 'views' => {}, 'filters' => {} }
22
+ vd = data[design_doc_name] ||= { 'views' => {}, 'filters' => {}, 'lists' => {}, 'lib' => {} }
23
23
 
24
24
  if key == 'filter'
25
25
  vd['filters'][name] = source
26
+ elsif key == 'lists'
27
+ vd['lists'][name] = source
28
+ elsif key == 'lib'
29
+ v = vd['views']['lib'] ||= {}
30
+ v[name] = source
26
31
  else
27
32
  v = vd['views'][name] ||= {}
28
33
  v[key] = source
@@ -49,6 +49,10 @@ class DocWithSameDefaults < Dolly::Document
49
49
  property :foo, :bar, class_name: Array, default: []
50
50
  end
51
51
 
52
+ class Bar < FooBar
53
+ property :a, :b
54
+ end
55
+
52
56
  class DocumentTest < ActiveSupport::TestCase
53
57
  DB_BASE_PATH = "http://localhost:5984/test".freeze
54
58
 
@@ -467,6 +471,11 @@ class DocumentTest < ActiveSupport::TestCase
467
471
  assert_equal Base64.encode64(data), doc.doc['_attachments']['test.txt']['data']
468
472
  end
469
473
 
474
+ test "new object from inhereted document" do
475
+ assert bar = Bar.new(a: 1)
476
+ assert_equal 1, bar.a
477
+ end
478
+
470
479
  private
471
480
  def generic_response rows, count = 1
472
481
  {total_rows: count, offset:0, rows: rows}