sqlite3_hash 1.0.0 → 1.0.4

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
- SHA1:
3
- metadata.gz: 07d1d1ce69db0d02ce3b805a4b052fe98054ee30
4
- data.tar.gz: 8938ff1f168af62aa921688214839c4b9b789859
2
+ SHA256:
3
+ metadata.gz: 527de2a8ca692a2b2eca23bfa4af6e163cb5c0506fa1f21696ac1e9233c3631a
4
+ data.tar.gz: a8db5f74b739de78277522f600a598ad79c27f81c63767a88b94f07ac48bb42c
5
5
  SHA512:
6
- metadata.gz: 02b0ed65f1a3ef07cd6bd32152099e626d52b68cb1b8054f5337ce4b2f4b3b8b45d25d94ba816e5adfd5cfad6df7335725206cc792737753a2469d46d1c04eda
7
- data.tar.gz: 9a9d574781ffce90a30b93eee82a05a8f60b7b089f8ea00952a3401b7798d465abf195c2fccecacaf3136ee87355dfc1164cc9614351479a634fe465aabb550e
6
+ metadata.gz: 828d5739abe4f4a7275fd9049fef5b76c491cfb4b807ce7bf4df3b926fc02c2f7a359b2092c70435451a94787e71377f33ee3a12d73adaf684a7f823959f9afc
7
+ data.tar.gz: 3572485fc2e5c59f143b3e3d73e15f52380f55f077a8b84cba59f7080b38e603479d340dec039a6be36fe83f59a4b0888fc37a69e2f0a828109ac51ac23be1fb
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  A persistent simple Hash backed by sqlite3
4
4
 
5
- Contains (almost) the same features/API as the Ruby 2.0.0 Hash object
5
+ Contains (almost) the same features/API as the Ruby Hash object (v2.0.0)
6
6
 
7
7
  ## Installation
8
8
 
@@ -29,6 +29,7 @@ which can be re-used over multiple instantiations of ruby.
29
29
 
30
30
  Example case:
31
31
 
32
+ require 'rubygems'
32
33
  require 'sqlite3_hash'
33
34
 
34
35
  shash = SQLite3Hash.new('tmpfile.db')
@@ -48,6 +49,13 @@ Keys are anything that can be Marshalled.
48
49
 
49
50
  This means, for example, that you *cannot* store Procs in an SQLite3Hash
50
51
 
52
+ You can use the same SQLite3 DB for multiple hashes:
53
+
54
+ require 'rubygems'
55
+ require 'sqlite3_hash'
56
+ hash1 = SQLite3Hash.new('tmpfile.db','hash1')
57
+ hash2 = SQLite3Hash.new('tmpfile.db','hash2')
58
+
51
59
  Contains all the Hash class methods from 2.0.0 except:
52
60
 
53
61
  1. No deprecated methods
@@ -60,18 +68,20 @@ For example:
60
68
 
61
69
  a = [ "a", "b" ]
62
70
  h = { a => 100 }
63
- sh = SQLite3Hash('tmp.db')
64
- a[0] = 'z'
71
+ sh = SQLite3Hash('tmp.db', h)
72
+ a[0] = 'z' # This only effects 'h' not 'sh'
65
73
  h # => {["z", "b"]=>100}
66
74
  sh # => {["a", "b"]=>100}
67
75
 
68
76
 
69
77
  ## Development
70
78
 
71
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
79
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bundle exec rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
72
80
 
73
81
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
74
82
 
83
+ (This should probably someday be rewritten using mixins or inheritance.)
84
+
75
85
  ## Contributing
76
86
 
77
87
  Bug reports and pull requests are welcome on GitHub at https://github.com/daveola/sqlite3_hash.
@@ -1,3 +1,3 @@
1
1
  module Sqlite3Hash
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.4"
3
3
  end
data/lib/sqlite3_hash.rb CHANGED
@@ -2,10 +2,11 @@ require "sqlite3_hash/version"
2
2
 
3
3
  # Filename: sqlite3hash.rb
4
4
  # Author: David Ljung Madison <DaveSource.com>
5
- # See License: http://MarginalHacks.com/License/
5
+ # More Info: http://MarginalHacks.com/
6
+ # License: [MIT License](http://opensource.org/licenses/MIT).
6
7
  # Description: An sqlite3 backed simple hash in ruby
7
8
  #
8
- # Handles values of String, Fixnum, Float, and anything that can be Marshalled
9
+ # Handles values of String, Integer, Float, and anything that can be Marshalled
9
10
  # Keys are anything that can be Marshalled
10
11
  # This means, for example, that you cannot store Procs in an SQLite3Hash
11
12
  #
@@ -18,8 +19,8 @@ require "sqlite3_hash/version"
18
19
  # 5) Uses the value of an object instead of the object as a key, i.e.:
19
20
  # a = [ "a", "b" ]
20
21
  # h = { a => 100 }
21
- # sh = SQLite3Hash('tmp.db')
22
- # a[0] = 'z'
22
+ # sh = SQLite3Hash('tmp.db', h)
23
+ # a[0] = 'z' # This only effects 'h' not 'sh'
23
24
  # h # => {["z", "b"]=>100}
24
25
  # sh # => {["a", "b"]=>100}
25
26
 
@@ -98,7 +99,7 @@ class SQLite3Hash
98
99
  rows = {
99
100
  'valueString' => nil,
100
101
  'valueSymbol' => nil,
101
- 'valueFixnum' => nil,
102
+ 'valueInteger' => nil,
102
103
  'valueFloat' => nil,
103
104
  'valueMarshal' => nil,
104
105
  }
@@ -111,7 +112,7 @@ class SQLite3Hash
111
112
  keys.push(k)
112
113
  values.push(v)
113
114
  }
114
- @sqldb.execute("insert or replace into '#{@table}'(#{keys.join(',')}) VALUES(#{(['?']*values.size).join(',')})",*values)
115
+ @sqldb.execute("insert or replace into '#{@table}'(#{keys.join(',')}) VALUES(#{(['?']*values.size).join(',')})",values)
115
116
  end
116
117
  alias :set :[]=
117
118
  alias :write :[]=
@@ -349,7 +350,7 @@ class SQLite3Hash
349
350
  end
350
351
  def rowValue(value)
351
352
  c = value.class
352
- return ["value#{c.to_s}",value] if c==Fixnum || c==String || c==Float
353
+ return ["value#{c.to_s}",value] if c==Integer || c==String || c==Float
353
354
  return ["value#{c.to_s}",value.to_s] if c==Symbol
354
355
  return ["valueMarshal",Marshal.dump(value)]
355
356
  end
@@ -360,7 +361,7 @@ class SQLite3Hash
360
361
  def createTable(h=Hash.new)
361
362
  # Check if table exists
362
363
  return if @sqldb.get_first_value( %{select name from sqlite_master where name = :name}, {:name => @table} )
363
- @sqldb.execute("create table '#{@table}' (key TEXT not null unique, valueString TEXTS, valueFixnum INTEGER, valueFloat REAL, valueSymbol TEXTS, valueMarshal TEXTS)")
364
+ @sqldb.execute("create table '#{@table}' (key TEXT not null unique, valueString TEXTS, valueInteger INTEGER, valueFloat REAL, valueSymbol TEXTS, valueMarshal TEXTS)")
364
365
  h.each { |k,v| set(k,v) } if h
365
366
  end
366
367
  end
data/sqlite3_hash.gemspec CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ["http://Contact.MarginalHacks.com/"]
11
11
 
12
12
  spec.summary = %q{A persistent simple Hash backed by sqlite3}
13
- spec.description = %q{A persistent simple Hash backed by sqlite3\n\nContains (almost) the same features/API as the Ruby 2.0.0 Hash object}
13
+ spec.description = "A persistent simple Hash backed by sqlite3.\n\nContains (almost) the same features/API as the Ruby 2.0.0 Hash object"
14
14
  spec.homepage = "http://MarginalHacks.com/"
15
15
  spec.license = "MIT"
16
16
 
@@ -27,8 +27,8 @@ Gem::Specification.new do |spec|
27
27
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
28
  spec.require_paths = ["lib"]
29
29
 
30
- spec.add_development_dependency "bundler", "~> 1.11"
31
- spec.add_development_dependency "rake", "~> 10.0"
30
+ spec.add_development_dependency "bundler", ">= 2.2.10"
31
+ spec.add_development_dependency "rake", ">= 12.3.3"
32
32
  #spec.add_development_dependency "true", "~> "
33
33
  spec.add_development_dependency "rspec"
34
34
  spec.add_dependency "sqlite3"
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sqlite3_hash
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Ljung Madison Stellar
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-01-09 00:00:00.000000000 Z
11
+ date: 2025-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.11'
19
+ version: 2.2.10
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.11'
26
+ version: 2.2.10
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: 12.3.3
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: 12.3.3
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -66,8 +66,10 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
- description: A persistent simple Hash backed by sqlite3\n\nContains (almost) the same
70
- features/API as the Ruby 2.0.0 Hash object
69
+ description: |-
70
+ A persistent simple Hash backed by sqlite3.
71
+
72
+ Contains (almost) the same features/API as the Ruby 2.0.0 Hash object
71
73
  email:
72
74
  - http://Contact.MarginalHacks.com/
73
75
  executables: []
@@ -89,7 +91,7 @@ homepage: http://MarginalHacks.com/
89
91
  licenses:
90
92
  - MIT
91
93
  metadata: {}
92
- post_install_message:
94
+ post_install_message:
93
95
  rdoc_options: []
94
96
  require_paths:
95
97
  - lib
@@ -104,9 +106,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
104
106
  - !ruby/object:Gem::Version
105
107
  version: '0'
106
108
  requirements: []
107
- rubyforge_project:
108
- rubygems_version: 2.5.1
109
- signing_key:
109
+ rubygems_version: 3.5.16
110
+ signing_key:
110
111
  specification_version: 4
111
112
  summary: A persistent simple Hash backed by sqlite3
112
113
  test_files: []