bloc_record 0.0.0 → 0.0.1
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 +4 -4
- data/bloc_record.gemspec +3 -3
- data/lib/bloc_record/associations.rb +3 -3
- data/lib/bloc_record/persistence.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 228c6414b6b77f66d3bdab7cd05871fd0be73b0c
|
4
|
+
data.tar.gz: f8b9af158a88b18008adc2c67ef826416de0bce8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c592fe7ae07c5b50ef81c500e59dba7ffc89285ff5c0284f5935a06e466abd1c686a807d30feea93b6eb9ad2cc482fcc84905cd00d0b997bf652a5284544985
|
7
|
+
data.tar.gz: 581e0b7025994ce67d4794e28c47d297e675b575d76a88a5f7fe8e057514d71fb99600584f9cd8ca39c1d9d7908bfdbd958b495101e26304ea3c115c6273d3d8
|
data/bloc_record.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'bloc_record'
|
3
|
-
s.version = '0.0.
|
4
|
-
s.date = '2015-
|
3
|
+
s.version = '0.0.1'
|
4
|
+
s.date = '2015-01-18'
|
5
5
|
s.summary = 'An ActiveRecord-esque ORM adaptor'
|
6
6
|
s.description = 'An ActiveRecord-esque ORM adaptor'
|
7
7
|
s.authors = ['Ben Neely']
|
@@ -14,5 +14,5 @@ Gem::Specification.new do |s|
|
|
14
14
|
'http://rubygems.org/gems/bloc_record'
|
15
15
|
s.license = 'MIT'
|
16
16
|
s.add_runtime_dependency 'sqlite3', '~> 1.3'
|
17
|
-
s.add_runtime_dependency 'activesupport'
|
17
|
+
s.add_runtime_dependency 'activesupport', '~> 4.2'
|
18
18
|
end
|
@@ -3,7 +3,7 @@ require 'active_support/inflector'
|
|
3
3
|
|
4
4
|
module Associations
|
5
5
|
def has_many(association)
|
6
|
-
|
6
|
+
define_method(association) do
|
7
7
|
rows = self.class.connection.execute <<-SQL
|
8
8
|
SELECT * FROM #{association.to_s.singularize}
|
9
9
|
WHERE #{self.class.table}_id = #{self.id}
|
@@ -15,13 +15,13 @@ module Associations
|
|
15
15
|
rows.each do |row|
|
16
16
|
collection << class_name.new(Hash[class_name.columns.zip(row)])
|
17
17
|
end
|
18
|
-
|
18
|
+
|
19
19
|
collection
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
23
|
def belongs_to(association)
|
24
|
-
|
24
|
+
define_method(association) do
|
25
25
|
association_name = association.to_s
|
26
26
|
row = self.class.connection.get_first_row <<-SQL
|
27
27
|
SELECT * FROM #{association_name}
|
@@ -13,7 +13,7 @@ module Persistence
|
|
13
13
|
vals = attributes.map { |key| BlocRecord::Utility.sql_strings(attrs[key]) }
|
14
14
|
|
15
15
|
connection.execute(
|
16
|
-
"INSERT INTO #{table} (#{attributes.join(",")}) VALUES (?)",
|
16
|
+
"INSERT INTO #{table} (#{attributes.join(",")}) VALUES (#{vals.map {|x| '?'}.join(', ')})",
|
17
17
|
vals.join(",")
|
18
18
|
)
|
19
19
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bloc_record
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Neely
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-01-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sqlite3
|
@@ -28,16 +28,16 @@ dependencies:
|
|
28
28
|
name: activesupport
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '4.2'
|
34
34
|
type: :runtime
|
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: '
|
40
|
+
version: '4.2'
|
41
41
|
description: An ActiveRecord-esque ORM adaptor
|
42
42
|
email: ben@bloc.io
|
43
43
|
executables: []
|