tiny-record 0.1.0 → 1.0.0

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
- SHA256:
3
- metadata.gz: 042a8437dea9a70de07437768d4b9186fb027c45bcd9bdbf2356d8a5b94b1e52
4
- data.tar.gz: 36e00d44e2bfcecd0b25677c702ab4a885d88dfae0d9ec45fd9a697083a74139
2
+ SHA1:
3
+ metadata.gz: f9d27daa4f162a7810b594a110530209875a3a82
4
+ data.tar.gz: 7dd74f59d7430dceb79b65b4a43c830ab58416b5
5
5
  SHA512:
6
- metadata.gz: f5af7edbc38e06931990ec3a404a473eca8115cc5358e64f7549eca1be8032e6da269d4f47b3098fd93914be21f29f072b65b64e581a8d4aa1868339bdaa10d4
7
- data.tar.gz: bcd0069bdf184099075ea25f1d7574f74106716ebb0af83936ddf32ce627925a2035fd398072bdddd8cef96fa6f00c4a3a0efd60727fc09eed140692d0c03583
6
+ metadata.gz: d6f19d8dad6eb349f68261ad5a5ff889ffd2aa85a2129548261d0a2496bb717063e83a5b9238c5fbcbb34a0009224cff618bf56007511f60a4b2cd9008803d74
7
+ data.tar.gz: 04e05b735ac1ba82b87f06cd25bf0f31562998606d226169e78651e89d225e16cf8a146914ca4137130ce470acad3db5dbc163d83fcb012867b0e497b2c1c739
data/.travis.yml CHANGED
@@ -4,4 +4,9 @@ language: ruby
4
4
  cache: bundler
5
5
  rvm:
6
6
  - 2.3.6
7
- before_install: gem install bundler -v 1.16.3
7
+ before_install:
8
+ - mysql -e 'CREATE DATABASE IF NOT EXISTS memory;'
9
+ - gem install bundler -v 1.16.3
10
+ services:
11
+ - mysql
12
+ if: branch = master OR type = 'pull_request'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tiny-record (0.1.0)
4
+ tiny-record (1.0.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -1,9 +1,9 @@
1
+ [![Build Status](https://travis-ci.com/vikasvr/tiny-record.svg?branch=master)](https://travis-ci.com/vikasvr/tiny-record)
2
+
1
3
  # TinyRecord
2
4
 
3
5
  TinyRecord gives to you the capability to target columns when you try to look for active record objects specifying the columns you want to use which gives you speed. Logic is simple, less the data you will ask for, faster database response would be.
4
6
 
5
-
6
-
7
7
  ## Installation
8
8
 
9
9
  Add this line to your application's Gemfile:
@@ -40,6 +40,15 @@ Or install it yourself as:
40
40
  ```
41
41
  Just like rails find_by, it will return nil when record not found.
42
42
 
43
+ You can also set defaults by:
44
+ ```ruby
45
+ class User < ApplicationRecord
46
+ include TinyRecord
47
+ tiny_columns :id, :first_name
48
+ end
49
+ ```
50
+ Now whenever you use fetch or fetch by method record will be returned with these default columns.
51
+ You can override these defaults by specifying the columns.
43
52
 
44
53
  ## Contributing
45
54
 
@@ -1,5 +1,5 @@
1
1
  module Tiny
2
2
  module Record
3
- VERSION = "0.1.0"
3
+ VERSION = "1.0.0"
4
4
  end
5
5
  end
data/lib/tiny/record.rb CHANGED
@@ -12,7 +12,7 @@ module TinyRecord
12
12
  end
13
13
 
14
14
  def fetch(id, with: @@with_columns)
15
- get({primary_key => id}, with).take!
15
+ get(primary_lookup(id), with).take!
16
16
  end
17
17
 
18
18
  def fetch_by(columns = {})
@@ -25,5 +25,9 @@ module TinyRecord
25
25
  collection = collection.select(with_columns) if with_columns.present?
26
26
  collection
27
27
  end
28
+
29
+ def primary_lookup(lookup_id)
30
+ { primary_key => lookup_id }
31
+ end
28
32
  end
29
33
  end
data/tiny-record.gemspec CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
17
17
  # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
18
  # to allow pushing to a single host or delete this section to allow pushing to any host.
19
19
  # if spec.respond_to?(:metadata)
20
- # spec.metadata["allowed_push_host"] = 'https://rubygems.org/'
20
+ # spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
21
21
  # else
22
22
  # raise "RubyGems 2.0 or newer is required to protect against " \
23
23
  # "public gem pushes."
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tiny-record
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vikas Verma
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-05-07 00:00:00.000000000 Z
11
+ date: 2019-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -120,7 +120,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
120
  - !ruby/object:Gem::Version
121
121
  version: '0'
122
122
  requirements: []
123
- rubygems_version: 3.0.3
123
+ rubyforge_project:
124
+ rubygems_version: 2.6.14
124
125
  signing_key:
125
126
  specification_version: 4
126
127
  summary: target columns when querying for active record objects