lazy_records 0.0.2 → 0.0.3

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: bace4538e07a4bafa4e4e151c0cbf32526aff5ba
4
- data.tar.gz: b74b0dc6ff4da1070ab83b485d59ad3cc56a049c
3
+ metadata.gz: fd7a68f028ff135994cc7a26a6c2227ed5b6391c
4
+ data.tar.gz: c4e178058ce9ad3e57869c44b045dc94192338b1
5
5
  SHA512:
6
- metadata.gz: 52a846c3b05ccb791110f59e8003c1d3c30f744c909cd9257602ab3d9e464f0fc9e373766c32f75207a49db56f6f8cd8238819babbadda842003130091682139
7
- data.tar.gz: 16d5408c0b02e716f2840e9b2a24fc84ed6bee5bbad6b0256313a845b3fee419122d382b3bb583c5b477d920e5fba408fc0ef749dfb4e18aeb705aceac3fc209
6
+ metadata.gz: d41d97f08b04d743b80b8184f8c9fddd79a994b78e0487581a21ffbd8067e767fcd87382975d5d8e91a177e587bd32e0b890a25d1ba36efbc19ed26fe8d966b0
7
+ data.tar.gz: 417241c64d24a1fda08d8ff4e53b1861895523349bc1c060a4181fdd287ab02ad56857785fe45859fd1aa314f8896a5b56467cae50c6b4fc33c5b53e02aea175
data/Gemfile CHANGED
@@ -5,7 +5,7 @@ source 'http://rubygems.org'
5
5
  gem 'totally_lazy'
6
6
  gem 'lock_method'
7
7
  gem 'encrypted_strings'
8
- gem 'mysql2'
8
+ # gem 'mysql2'
9
9
  # gem 'tiny_tds'
10
10
 
11
11
  # Add dependencies to develop your gem here.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- activesupport (4.1.6)
4
+ activesupport (4.1.7)
5
5
  i18n (~> 0.6, >= 0.6.9)
6
6
  json (~> 1.7, >= 1.7.7)
7
7
  minitest (~> 5.1)
@@ -18,11 +18,11 @@ GEM
18
18
  faraday (0.9.0)
19
19
  multipart-post (>= 1.2, < 3)
20
20
  git (1.2.8)
21
- github_api (0.12.1)
21
+ github_api (0.12.2)
22
22
  addressable (~> 2.3)
23
23
  descendants_tracker (~> 0.0.4)
24
24
  faraday (~> 0.8, < 0.10)
25
- hashie (>= 3.2)
25
+ hashie (>= 3.3)
26
26
  multi_json (>= 1.7.5, < 2.0)
27
27
  nokogiri (~> 1.6.3)
28
28
  oauth2
@@ -43,14 +43,13 @@ GEM
43
43
  lock_method (0.5.5)
44
44
  activesupport
45
45
  cache (>= 0.2.1)
46
- mini_portile (0.6.0)
47
- minitest (5.4.2)
46
+ mini_portile (0.6.1)
47
+ minitest (5.4.3)
48
48
  multi_json (1.10.1)
49
49
  multi_xml (0.5.5)
50
50
  multipart-post (2.0.0)
51
- mysql2 (0.3.16)
52
- nokogiri (1.6.3.1)
53
- mini_portile (= 0.6.0)
51
+ nokogiri (1.6.4.1)
52
+ mini_portile (~> 0.6.0)
54
53
  oauth2 (1.0.0)
55
54
  faraday (>= 0.8, < 0.10)
56
55
  jwt (~> 1.0)
@@ -79,7 +78,7 @@ GEM
79
78
  simplecov-html (~> 0.8.0)
80
79
  simplecov-html (0.8.0)
81
80
  thread_safe (0.3.4)
82
- totally_lazy (0.0.6)
81
+ totally_lazy (0.0.7)
83
82
  tzinfo (1.2.2)
84
83
  thread_safe (~> 0.1)
85
84
 
@@ -91,7 +90,6 @@ DEPENDENCIES
91
90
  encrypted_strings
92
91
  jeweler (~> 2.0.1)
93
92
  lock_method
94
- mysql2
95
93
  rdoc (~> 3.12)
96
94
  rspec (~> 3.0.0.rc1)
97
95
  simplecov
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.2
1
+ 0.0.3
data/lazy_records.gemspec CHANGED
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: lazy_records 0.0.2 ruby lib
5
+ # stub: lazy_records 0.0.3 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "lazy_records"
9
- s.version = "0.0.2"
9
+ s.version = "0.0.3"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Kingsley Hendrickse"]
14
- s.date = "2014-11-02"
14
+ s.date = "2014-11-15"
15
15
  s.description = "port of lazy records to ruby"
16
16
  s.email = "kingsley.hendrickse@gmail.com"
17
17
  s.extra_rdoc_files = [
@@ -59,7 +59,6 @@ Gem::Specification.new do |s|
59
59
  s.add_runtime_dependency(%q<totally_lazy>, [">= 0"])
60
60
  s.add_runtime_dependency(%q<lock_method>, [">= 0"])
61
61
  s.add_runtime_dependency(%q<encrypted_strings>, [">= 0"])
62
- s.add_runtime_dependency(%q<mysql2>, [">= 0"])
63
62
  s.add_development_dependency(%q<rspec>, ["~> 3.0.0.rc1"])
64
63
  s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
65
64
  s.add_development_dependency(%q<bundler>, ["~> 1.0"])
@@ -69,7 +68,6 @@ Gem::Specification.new do |s|
69
68
  s.add_dependency(%q<totally_lazy>, [">= 0"])
70
69
  s.add_dependency(%q<lock_method>, [">= 0"])
71
70
  s.add_dependency(%q<encrypted_strings>, [">= 0"])
72
- s.add_dependency(%q<mysql2>, [">= 0"])
73
71
  s.add_dependency(%q<rspec>, ["~> 3.0.0.rc1"])
74
72
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
75
73
  s.add_dependency(%q<bundler>, ["~> 1.0"])
@@ -80,7 +78,6 @@ Gem::Specification.new do |s|
80
78
  s.add_dependency(%q<totally_lazy>, [">= 0"])
81
79
  s.add_dependency(%q<lock_method>, [">= 0"])
82
80
  s.add_dependency(%q<encrypted_strings>, [">= 0"])
83
- s.add_dependency(%q<mysql2>, [">= 0"])
84
81
  s.add_dependency(%q<rspec>, ["~> 3.0.0.rc1"])
85
82
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
86
83
  s.add_dependency(%q<bundler>, ["~> 1.0"])
@@ -20,9 +20,9 @@ module LazyRecords
20
20
 
21
21
  def get(definition, selection=nil)
22
22
  if selection
23
- @store.filter(where(key: equals(definition.name))).send(:filter, selection).map { |row| row.value }.head
23
+ @store.filter(where(key: equals(definition.name))).send(:filter, selection).map { |row| row.value }.head_option.get_or_else(empty)
24
24
  else
25
- @store.filter(where(key: equals(definition.name))).map { |row| row.value }.head
25
+ @store.filter(where(key: equals(definition.name))).map { |row| row.value }.head_option.get_or_else(empty)
26
26
  end
27
27
  end
28
28
 
data/lib/sql_records.rb CHANGED
@@ -36,6 +36,10 @@ module LazyRecords
36
36
 
37
37
  def inner_join(def1, def2, keyword_map)
38
38
  sql = 'select ' + process_columns(def1, def2) + ' from ' + def1.name.to_s + ' inner join ' + def2.name.to_s + ' on ' + process_keywords(keyword_map, def1, def2)
39
+ sql_query(sql)
40
+ end
41
+
42
+ def sql_query(sql)
39
43
  sequence(@c.query(sql).map { |r| Record.new(r) })
40
44
  end
41
45
 
@@ -7,6 +7,13 @@ describe MemoryRecords do
7
7
  @records.remove_definition(:people)
8
8
  end
9
9
 
10
+ it 'should return empty if there are no records' do
11
+ name = keyword(:name)
12
+ age = keyword(:age)
13
+ people = definition(:people, name, age)
14
+ expect(@records.get(people)).to eq(empty)
15
+ end
16
+
10
17
  it 'should add records' do
11
18
  name = keyword(:name)
12
19
  age = keyword(:age)
@@ -7,6 +7,14 @@ describe SqlRecords do
7
7
  @records = SqlRecords.new(@c)
8
8
  end
9
9
 
10
+ it 'should return empty if there are no records' do
11
+ name = keyword(:name)
12
+ age = keyword(:age)
13
+ people = definition(:people, name, age)
14
+ allow(@c).to receive(:query).with('select * from people') {[]}
15
+ expect(@records.get(people)).to eq(empty)
16
+ end
17
+
10
18
  it 'should add records' do
11
19
  name = keyword(:name)
12
20
  age = keyword(:age)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lazy_records
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kingsley Hendrickse
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-02 00:00:00.000000000 Z
11
+ date: 2014-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: totally_lazy
@@ -52,20 +52,6 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: mysql2
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :runtime
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: rspec
71
57
  requirement: !ruby/object:Gem::Requirement