organizer-rails 0.1.1 → 0.1.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
  SHA256:
3
- metadata.gz: 26bc747de6f5a477353e2ca19dcd0592dd18662723c8905fe7430e3d3decb23a
4
- data.tar.gz: c4acc3251c897e028c192405b5dea12bd0d897e0ec28f88dceac884ec6654ac6
3
+ metadata.gz: cbe7dc049f0299d1cb5354f8ff08982077fae71faeaa9323754b3dbd895c0800
4
+ data.tar.gz: 2fcda84259a43a8137d0dfc86f9932f82588795f96acc545850fa0ca30ebaa0c
5
5
  SHA512:
6
- metadata.gz: d26d783fd10d2d19e030ad0c1f2b27bfb4a42c4198fffbd147c4484a5d66eec31aee996b9e2f96497eace3933e22c67820eb34beb4b02408f8600e990205294d
7
- data.tar.gz: c4a486dd39d3ef3908a3ff38ace1024933cd53575dbcdbc9439309dde4b5fe871295472ee1685c0a156bddea0995afa87b428ee01d8669fffec8e7dca8db2b83
6
+ metadata.gz: 51336e2f715dc1ad52120575ea33d023df747b47accda40f063bb5cc165aee07f290312114b8564e8f5bb2e281eb811c24c58185fd26a3f792b761eb636db081
7
+ data.tar.gz: d7640ccdd0a5991b7d41746b9e86dee2bf33d483f0dd27f7d4134fc30e1683e1668d7ce1dc1f2940a521dc74090472497dc535a7b2424d0f3123127e71c13976
data/README.md CHANGED
@@ -21,7 +21,7 @@ MyModel[:my_name] # => #<MyModel1 id: 1, name: "my_name">
21
21
  Add this line to your application's Gemfile:
22
22
 
23
23
  ```ruby
24
- gem "organizer-rails"
24
+ gem "organizer-rails", require: "organizer"
25
25
  ```
26
26
 
27
27
  And then execute:
@@ -1,3 +1,5 @@
1
+ require 'memery'
2
+
1
3
  module Organizer
2
4
  concern :Identifiable do
3
5
  class << self
@@ -8,7 +10,8 @@ module Organizer
8
10
  @identified_by = column_name
9
11
  end
10
12
 
11
- class_methods do # public API
13
+ class_methods do
14
+ # public API
12
15
  define_method(column_name.to_s.pluralize) { identifiers }
13
16
  end
14
17
  end
@@ -17,7 +20,9 @@ module Organizer
17
20
  end
18
21
 
19
22
  class_methods do
20
- def [] *id
23
+ include Memery
24
+
25
+ def [] * id
21
26
  return id.map { self[_1] } if id.many?
22
27
 
23
28
  case id = id.first
@@ -31,15 +36,13 @@ module Organizer
31
36
 
32
37
  private
33
38
 
34
- def identifiers
35
- @identifiers ||= # cache
36
- all.pluck(@identified_by)
37
- .map &:to_sym
39
+ memoize def identifiers
40
+ all.pluck(@identified_by)
41
+ .map &:to_sym
38
42
  end
39
43
 
40
- def identified_as identifier
41
- (@identified ||= {}.with_indifferent_access)[identifier] ||= # cache
42
- find_by @identified_by => identifier
44
+ memoize def identified_as identifier
45
+ find_by @identified_by => identifier
43
46
  end
44
47
  end
45
48
  end
@@ -1,3 +1,3 @@
1
1
  module Organizer
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: organizer-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Senko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-28 00:00:00.000000000 Z
11
+ date: 2024-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '7.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: memery
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  description: Use lists, tags, flags, etc. to organize your application records.
28
42
  email:
29
43
  - Alexander.Senko@gmail.com
@@ -58,7 +72,7 @@ licenses:
58
72
  metadata:
59
73
  homepage_uri: https://github.com/Alexander-Senko/organizer
60
74
  source_code_uri: https://github.com/Alexander-Senko/organizer
61
- changelog_uri: https://github.com/Alexander-Senko/organizer/CHANGELOG.md
75
+ changelog_uri: https://github.com/Alexander-Senko/organizer/blob/v0.1.3/CHANGELOG.md
62
76
  post_install_message:
63
77
  rdoc_options: []
64
78
  require_paths:
@@ -74,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
74
88
  - !ruby/object:Gem::Version
75
89
  version: '0'
76
90
  requirements: []
77
- rubygems_version: 3.5.3
91
+ rubygems_version: 3.5.5
78
92
  signing_key:
79
93
  specification_version: 4
80
94
  summary: Record organizer for Rails