repositor 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/repositor.rb +33 -0
- metadata +64 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8de094a3d20d025b30b033aca224814c68a65cf4
|
4
|
+
data.tar.gz: 97a2cb9b489fd10732379415f02963ea4441c772
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5452dbb2679341f27742b70af92304ca77936c61c823a9a9dfd551a7dd4d07af36f95f1f4e61963fc7f24da6bce2dba455199be7883676130797b35f09256a88
|
7
|
+
data.tar.gz: 4c985bc1c189479e26165b5a097572f6445f90826078f13c4df7c2806a9b1f9183aafb3f563c9e889f8c0d5d1b31e38a418dba486094e423503abdd6da78b967
|
data/lib/repositor.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
module Repositor
|
2
|
+
attr_reader :model
|
3
|
+
|
4
|
+
def model
|
5
|
+
self.class.to_s.chomp("Repo").singularize.constantize
|
6
|
+
end
|
7
|
+
|
8
|
+
def find(record_id)
|
9
|
+
model.send :find, record_id
|
10
|
+
end
|
11
|
+
|
12
|
+
def all
|
13
|
+
model.send :all
|
14
|
+
end
|
15
|
+
|
16
|
+
def new
|
17
|
+
model.send :new
|
18
|
+
end
|
19
|
+
|
20
|
+
def create(record_params)
|
21
|
+
model.send :create, record_params
|
22
|
+
end
|
23
|
+
|
24
|
+
def update(record_id, record_params)
|
25
|
+
find(record_id).tap do |record|
|
26
|
+
record.update(record_params)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def destroy(record_id)
|
31
|
+
find(record_id).destroy
|
32
|
+
end
|
33
|
+
end
|
metadata
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: repositor
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Volodya Sveredyuk
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-03-24 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rspec
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.4'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 3.4.0
|
23
|
+
type: :development
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '3.4'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 3.4.0
|
33
|
+
description: Create simple Repos for easy controllers
|
34
|
+
email: sveredyuk@gmail.com
|
35
|
+
executables: []
|
36
|
+
extensions: []
|
37
|
+
extra_rdoc_files: []
|
38
|
+
files:
|
39
|
+
- lib/repositor.rb
|
40
|
+
homepage: https://github.com/sveredyuk/repositor
|
41
|
+
licenses:
|
42
|
+
- MIT
|
43
|
+
metadata: {}
|
44
|
+
post_install_message:
|
45
|
+
rdoc_options: []
|
46
|
+
require_paths:
|
47
|
+
- lib
|
48
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0'
|
53
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '0'
|
58
|
+
requirements: []
|
59
|
+
rubyforge_project:
|
60
|
+
rubygems_version: 2.4.5.1
|
61
|
+
signing_key:
|
62
|
+
specification_version: 4
|
63
|
+
summary: Implementation of RepoPattern
|
64
|
+
test_files: []
|