minor: added grid store length accessor
This commit is contained in:
parent
d268595584
commit
1cbb5d01ef
|
@ -54,6 +54,9 @@ module GridFS
|
||||||
# Default is DEFAULT_CONTENT_TYPE
|
# Default is DEFAULT_CONTENT_TYPE
|
||||||
attr_accessor :content_type
|
attr_accessor :content_type
|
||||||
|
|
||||||
|
# Size of file in bytes
|
||||||
|
attr_reader :length
|
||||||
|
|
||||||
attr_accessor :metadata
|
attr_accessor :metadata
|
||||||
|
|
||||||
attr_reader :files_id
|
attr_reader :files_id
|
||||||
|
|
|
@ -71,6 +71,10 @@ class GridStoreTest < Test::Unit::TestCase
|
||||||
assert_equal "hello", GridStore.read(@@db, 'foobar', 5)
|
assert_equal "hello", GridStore.read(@@db, 'foobar', 5)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_access_length
|
||||||
|
assert_equal 13, GridStore.new(@@db, 'foobar').length
|
||||||
|
end
|
||||||
|
|
||||||
# Also tests seek
|
# Also tests seek
|
||||||
def test_read_with_offset
|
def test_read_with_offset
|
||||||
assert_equal "world", GridStore.read(@@db, 'foobar', 5, 7)
|
assert_equal "world", GridStore.read(@@db, 'foobar', 5, 7)
|
||||||
|
|
Loading…
Reference in New Issue