local_model 0.1.3 → 0.1.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
2
  SHA256:
3
- metadata.gz: a86bbe76f369c6f1b0a3984edbb58dcbc070dee5211afd9e50f22b1deb72f8bf
4
- data.tar.gz: cdda97bc5fc77dd8b54a628b49f5a7724b01a1f12b37dcb3b570971689b99e10
3
+ metadata.gz: 32aaa0557b37154955a584e86ddafab8b7dc5dac3731f77edb0817beeb511739
4
+ data.tar.gz: 731283ec3e8f5577551247b006d29f919cc22dc5bbef5726ee60e008f19fe35b
5
5
  SHA512:
6
- metadata.gz: fe2ca903606f84595f7decd590d994a4c48885b7c0bd7a4a86d67603cda157b3ebede305e30368abdaa5db694bd688a6ecf08aacd351818e2f7ebfe02bb9f8cf
7
- data.tar.gz: fa5d4d01e42968f74e0323c6173e95dc21e3a58d9d7e975740e7f082597c7d6728eacb78e84178298039dbe175448cd6cd4672c9a974a3f5124c762ba955ebfd
6
+ metadata.gz: af60390ff697de0be4c0b873af689ce0ad9f8169a883fab25a5b2ff933ce56e3603fa602d76fae1c36f966c71392eb3844c117f6614d228bde7a0c9a5aebc073
7
+ data.tar.gz: d1e7e26d09cbd221f29ac75ba885577fa78ed01170aeaf1a9c09501b1046f2824a4a1ac807a2ff22373a8c39a584aba4f749795bdc5e7d5d8ba6f29bda1bbb4d
data/README.md CHANGED
@@ -84,6 +84,36 @@ Does not support yet (notably):
84
84
  - .build, .update, validations, #<< to add many relationships
85
85
  - object equivalence if gotten from source twice
86
86
 
87
+
88
+ ### Namespace Methods
89
+
90
+ ```rb
91
+
92
+ LocalModel.config do |c|
93
+ c.path = "/home/me/data/"
94
+ c.cleanup_on_start = true # delete ALL files in path on startup
95
+ c.namespace = "InMemory" # Expect ALL LocalModels to be namespaced via this string
96
+ end
97
+
98
+ ```
99
+
100
+ ```rb
101
+ # in_memory/pokemon.rb
102
+
103
+ class InMemory::Pokemon < LocalModel::CSV
104
+
105
+ schema do |t|
106
+ t.string :name
107
+ t.string :nickname
108
+ t.integer :hp
109
+ t.string :species
110
+ end
111
+
112
+ end
113
+
114
+
115
+ ```
116
+
87
117
  ## Development
88
118
 
89
119
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
data/lib/local_model.rb CHANGED
@@ -45,7 +45,7 @@ module LocalModel
45
45
  @@namespace = configuration.namespace
46
46
  Dir.mkdir(configuration.path) unless Dir.exist?(configuration.path)
47
47
  if configuration.cleanup_on_start
48
- Dir.foreach do |f|
48
+ Dir.foreach(configuration.path) do |f|
49
49
  fn = File.join(configuration.path, f)
50
50
  File.delete(fn) if f != '.' && f != '..'
51
51
  end
@@ -1,3 +1,3 @@
1
1
  module LocalModel
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: local_model
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Micah Shute