mutils 0.2.32 → 0.2.33

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: 94f544d61e8e65387846ec47aefbbe0fd42d35083a598f74e6e8e2647382173d
4
- data.tar.gz: ee7af2cc6ff266ba8a3eaa6d31c55cec1dc4e3b8420d35520d74d7c2776af88d
3
+ metadata.gz: 543e19d14e1efe1b83a3feaef69cb6c363ed0002b7a4c33773490264a9b63af7
4
+ data.tar.gz: f042884675f443890c68f46f482395275b43606756a028c2d7ed67f1f2c91dff
5
5
  SHA512:
6
- metadata.gz: bb8e645231bc7fd06ab55906d75f854c33be32e8dcccc2bd47f3aa536deb205a493158cd7ba3d038f2149529933de369fd4a2de8a006e98702a73f2c226a1551
7
- data.tar.gz: 9ccc08ff5ccd67954c0fb36598250488cf90f5ec09a8fd40145590e86509a73baa1fc35961c1217b3e5542530450596eaf7d4e66c04c3c0c125a06103a046e87
6
+ metadata.gz: 1a6c9faf321ebbb9d352f6e2d618017e9b4f0678ebbd35b3282315177980ae20f09c28a353e88c877ad5f11f43b8f74aac060e408d6396877d54c7bae43fcb47
7
+ data.tar.gz: 7aa232e2f9cefe635fbd4fc3b3d9064d586eb8d85b0460476ff5482acb24953df9ddfd381f100006e62189caf1f53377c2bb80bac9ae014d23ce7eb454b8be51
data/.codeclimate.yml ADDED
@@ -0,0 +1,4 @@
1
+ plugins:
2
+ rubocop:
3
+ enabled: true
4
+ channel: rubocop-0-80
data/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## [v0.2.32](https://github.com/niteshpurohit/mutils/tree/v0.2.32) (2020-03-18)
4
+
5
+ [Full Changelog](https://github.com/niteshpurohit/mutils/compare/v0.2.31...v0.2.32)
6
+ **Improvement:**
7
+ - Less Memory Used
8
+ - Greator Performance
9
+
10
+ **Merged pull requests:**
11
+
12
+ - Feature/improve performance [\#21](https://github.com/niteshpurohit/mutils/pull/21) ([niteshpurohit](https://github.com/niteshpurohit))
13
+
3
14
  ## [v0.2.31](https://github.com/niteshpurohit/mutils/tree/v0.2.31) (2020-03-18)
4
15
 
5
16
  [Full Changelog](https://github.com/niteshpurohit/mutils/compare/v0.2.30...v0.2.31)
data/Gemfile.lock CHANGED
@@ -1,26 +1,26 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mutils (0.2.32)
4
+ mutils (0.2.33)
5
5
  activesupport (>= 4.2)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- actionpack (6.0.2.1)
11
- actionview (= 6.0.2.1)
12
- activesupport (= 6.0.2.1)
10
+ actionpack (6.0.2.2)
11
+ actionview (= 6.0.2.2)
12
+ activesupport (= 6.0.2.2)
13
13
  rack (~> 2.0, >= 2.0.8)
14
14
  rack-test (>= 0.6.3)
15
15
  rails-dom-testing (~> 2.0)
16
16
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
17
- actionview (6.0.2.1)
18
- activesupport (= 6.0.2.1)
17
+ actionview (6.0.2.2)
18
+ activesupport (= 6.0.2.2)
19
19
  builder (~> 3.1)
20
20
  erubi (~> 1.4)
21
21
  rails-dom-testing (~> 2.0)
22
22
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
23
- activesupport (6.0.2.1)
23
+ activesupport (6.0.2.2)
24
24
  concurrent-ruby (~> 1.0, >= 1.0.2)
25
25
  i18n (>= 0.7, < 2)
26
26
  minitest (~> 5.1)
@@ -45,7 +45,7 @@ GEM
45
45
  loofah (2.4.0)
46
46
  crass (~> 1.0.2)
47
47
  nokogiri (>= 1.5.9)
48
- method_source (0.9.2)
48
+ method_source (1.0.0)
49
49
  mini_portile2 (2.4.0)
50
50
  minitest (5.14.0)
51
51
  naws_xml (0.1.1.pre)
@@ -61,9 +61,9 @@ GEM
61
61
  nokogiri (>= 1.6)
62
62
  rails-html-sanitizer (1.3.0)
63
63
  loofah (~> 2.3)
64
- railties (6.0.2.1)
65
- actionpack (= 6.0.2.1)
66
- activesupport (= 6.0.2.1)
64
+ railties (6.0.2.2)
65
+ actionpack (= 6.0.2.2)
66
+ activesupport (= 6.0.2.2)
67
67
  method_source
68
68
  rake (>= 0.8.7)
69
69
  thor (>= 0.20.3, < 2.0)
@@ -14,21 +14,27 @@ module Mutils
14
14
  end
15
15
 
16
16
  def attributes(*attributes_list)
17
- parse_attributes_methods(attributes_list, 'attribute')
17
+ parse_attributes_methods(attributes_list, 'attributes')
18
18
  end
19
19
 
20
- def custom_methods(*method_list)
21
- parse_attributes_methods(method_list, 'method')
20
+ def custom_methods(*attributes_list)
21
+ parse_attributes_methods(attributes_list, 'method')
22
22
  end
23
23
 
24
24
  def parse_attributes_methods(list, type)
25
25
  self.attributes_to_serialize = {} if attributes_to_serialize.nil?
26
26
  list&.each do |attr|
27
- value = { method: type == 'method' }
27
+ value = { method: type == 'method', always_include: true }
28
28
  attributes_to_serialize[attr] = value
29
29
  end
30
30
  end
31
31
 
32
+ def custom_method(method_name, always_include = false)
33
+ self.attributes_to_serialize = {} if attributes_to_serialize.nil?
34
+ value = { method: true, always_include: always_include }
35
+ attributes_to_serialize[method_name] = value
36
+ end
37
+
32
38
  def relationship(relationship_name, options = {}, option_name = 'belongs_to')
33
39
  options = prepare_options(relationship_name, options, option_name)
34
40
  self.relationships = {} if relationships.nil?
@@ -26,7 +26,7 @@ module Mutils
26
26
  def fetch_attributes(attributes)
27
27
  hash = {}
28
28
  attributes&.keys&.each do |key|
29
- hash[key] = attributes[key.to_s.to_sym][:method] ? send(key) : scope.send(key)
29
+ check_if_included(attributes, key) && (hash[key] = attributes[key][:method] ? send(key) : scope.send(key))
30
30
  end
31
31
  hash
32
32
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Mutils
4
- VERSION = '0.2.32'
4
+ VERSION = '0.2.33'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mutils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.32
4
+ version: 0.2.33
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nitesh Purohit
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-03-18 00:00:00.000000000 Z
11
+ date: 2020-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -115,6 +115,7 @@ executables: []
115
115
  extensions: []
116
116
  extra_rdoc_files: []
117
117
  files:
118
+ - ".codeclimate.yml"
118
119
  - ".github/CONTRIBUTING.md"
119
120
  - ".github/ISSUE_TEMPLATE.md"
120
121
  - ".github/ISSUE_TEMPLATE/bug_report.md"
@@ -155,7 +156,7 @@ licenses:
155
156
  - MIT
156
157
  metadata:
157
158
  bug_tracker_uri: https://github.com/niteshpurohit/mutils/issues
158
- source_code_uri: https://github.com/niteshpurohit/mutils/tree/v0.2.32
159
+ source_code_uri: https://github.com/niteshpurohit/mutils/tree/v0.2.33
159
160
  post_install_message:
160
161
  rdoc_options: []
161
162
  require_paths: