activerecord_lite 0.1.0 → 0.2.0
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 +5 -5
- data/README.md +5 -13
- data/lib/activerecord_lite/base.rb +1 -1
- data/lib/activerecord_lite/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2054908383b70bbc7e9377bd181c16ecb34b6023cefc176e6c536f334a561dc6
|
4
|
+
data.tar.gz: 14bb620133fd7471fc5a0855d9469395d9c2ab915ee2935023047edf85ab481d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '01811355646ef387c03d1073861cb2e262a3affac458aa8fdd848e32e2dd347016aa7ead3139092d5048ff5b79b238a21a8c7fc30bdef0513b3c393efcb8aeba'
|
7
|
+
data.tar.gz: b87225437dcc59adf8f363deee39278e94f88c4a25f5c9e8854c8ae350858ce8dde039bbdfeea22c987011ec54711f5f09654c8ab3531236f179b542693ed411
|
data/README.md
CHANGED
@@ -1,9 +1,3 @@
|
|
1
|
-
# ActiverecordLite
|
2
|
-
|
3
|
-
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/activerecord_lite`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
6
|
-
|
7
1
|
## Installation
|
8
2
|
|
9
3
|
Add this line to your application's Gemfile:
|
@@ -22,15 +16,13 @@ Or install it yourself as:
|
|
22
16
|
|
23
17
|
## Usage
|
24
18
|
|
25
|
-
|
26
|
-
|
27
|
-
## Development
|
19
|
+
(ActiveRecord Query).fetch_lite(:attribute1, :attribute2, ...)
|
28
20
|
|
29
|
-
|
21
|
+
(ActiveRecord Query).fetch_lite(attribute1: :name, attribute2: value)
|
30
22
|
|
31
|
-
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).
|
32
23
|
|
33
|
-
|
24
|
+
Ex:
|
34
25
|
|
35
|
-
|
26
|
+
Account.where(status: 1).fetch_lite(:name, :code)
|
36
27
|
|
28
|
+
Account.where(status: 1).fetch_lite(name: :account_name, code: :account_code)
|
@@ -2,7 +2,7 @@ module ActiveRecordLite
|
|
2
2
|
module Base
|
3
3
|
def fetch_lite(*select_sql)
|
4
4
|
select_columns, columns = prepare(select_sql)
|
5
|
-
_struct = Struct.new(*columns)
|
5
|
+
_struct = Struct.new(self.name, *columns)
|
6
6
|
sql = select(select_columns).to_sql
|
7
7
|
self.connection.select_all(sql).map { |result| _struct.new(*result.values) }
|
8
8
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord_lite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adriano Bacha
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-07-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -101,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
101
101
|
version: '0'
|
102
102
|
requirements: []
|
103
103
|
rubyforge_project:
|
104
|
-
rubygems_version: 2.
|
104
|
+
rubygems_version: 2.7.7
|
105
105
|
signing_key:
|
106
106
|
specification_version: 4
|
107
107
|
summary: lightweight activerecord queries
|