Skip to content

Commit

Permalink
Merge branch 'master' into new-views
Browse files Browse the repository at this point in the history
  • Loading branch information
Yurii Rashkovskii committed May 22, 2008
2 parents 6a6f9d1 + 5c90fb1 commit 08934af
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
4 changes: 4 additions & 0 deletions lib/strokedb/util/lazy_mapping_array.rb
Expand Up @@ -135,6 +135,10 @@ def include?(v)
def to_a
Array.new(map{|v| v})
end

def ==(arr)
to_a == arr
end

def class
Array
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/strokedb/document/document_spec.rb
Expand Up @@ -224,7 +224,7 @@
@document.metas_slot = [Meta]
@document = @document.save!.reload
@document.meta_slot.should == Meta.document(@document.store)
@document.metas_slot.to_a.should == [Meta.document(@document.store)]
@document.metas_slot.should == [Meta.document(@document.store)]
end

it "should not save itself once declared immutable" do
Expand Down
7 changes: 5 additions & 2 deletions spec/lib/strokedb/util/lazy_mapping_array_spec.rb
Expand Up @@ -18,7 +18,7 @@
end
end

describe "LazyMappingArray instance with block specified" do
describe "LazyMappingArray instance with map/unmap specified" do
before(:each) do
@original = [1,2,3,[1],[2]]
@mapper = proc {|arg| arg.to_s }
Expand Down Expand Up @@ -167,5 +167,8 @@
@array.should_not include("10")
end

it "should be == to similar non-lazy array" do
@array.should == @original.map{|v| @mapper.call(v)}
end

end

0 comments on commit 08934af

Please sign in to comment.