reportinator 0.3.2 → 0.3.4

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: 1640b58d6109a19bdbf48ce1065c18cee4e026a0eb4e4fc0b983664258d3794d
4
- data.tar.gz: '097529bb768d21517db8d511fa9b7b17c029c8a513bbdd95ee52e8d8e2747450'
3
+ metadata.gz: 3fa142f62bf64fea52b94bf48ae3b3140abaf43b24fdcfdf9d761325100acb9b
4
+ data.tar.gz: e9202b064a058c7371956b5ee3256d45892ff61e8aeb8d0958aa22cb8f5168fd
5
5
  SHA512:
6
- metadata.gz: a8fc97d8d0d8ad6a780d25cd07ee87ef52960b9175be94f8b9cc6f8714921b5a489cfedd77a3546ad73b8dd68e61d918ef515d221b744427490c6c949a980bbb
7
- data.tar.gz: 8b94e32337cf10a45ac0a699e729e1361d649a0122bf4e09696cee054fc45c3318a58d72b4394816f62313ae4ecef2f2e3e70c54dff7dd9654de463430c13210
6
+ metadata.gz: 8897b1b8cbf446d24b682e5d443433e061f2b5ae06f22c3962823a35faadd0f41f4c05300174452b711bfd894fe1a17d3fcb658814528511c72241825ed571a5
7
+ data.tar.gz: 846c99513a7b0e36767853e4f1dafb138040f4a661c7104c7bd3a101868ab4511b74629e85b27049781182a3aaa4620faf5ab3cbd990f11509693d756b649aaf
data/CHANGELOG.md CHANGED
@@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.3.4] 2022-11-29
9
+ ### Fixed
10
+ - Strings, Arrays and Hashes are now duplicated regardless of the ValueParser parameter
11
+
12
+ ## [0.3.3] 2022-11-28
13
+ ### Fixed
14
+ - Target parsed by ValueParser.parse_and_execute method no longer is duplicated
15
+ - This fixes a bug where active record relations would not properly function
16
+ - ValueParser.parse has now a third parameter, a boolean on whether to duplicate
17
+
8
18
  ## [0.3.2] 2022-11-24
9
19
  ### Fixed
10
20
  - Reference to schema file
@@ -48,15 +48,15 @@ module Reportinator
48
48
  private
49
49
 
50
50
  def send_value(target, method, value = nil)
51
- method = method.to_s
52
51
  return nil unless target_has_method?(target, method)
52
+ method = method.to_s
53
53
  return target.send(method) unless value.present?
54
54
  return target.send(method, *value) if value.instance_of?(Array)
55
55
  target.send(method, value)
56
56
  end
57
57
 
58
58
  def target_has_method?(target, method)
59
- target.methods.include?(method.to_sym)
59
+ target.respond_to?(method)
60
60
  end
61
61
 
62
62
  def parse_method(target, method)
@@ -1,18 +1,22 @@
1
1
  module Reportinator
2
2
  class ValueParser < Parser
3
+ FORCE_DUP = [String, Hash, Array]
4
+
3
5
  attribute :element
4
6
  attribute :metadata, default: {}
5
7
 
6
- def self.parse(element, metadata = {})
8
+ def self.parse(element, metadata = {}, dup = true)
7
9
  metadata = metadata.present? ? metadata : {}
8
- new(element: element.dup, metadata: metadata).output
10
+ dup = true if FORCE_DUP.include? element.class
11
+ input_element = (dup ? element.dup : element)
12
+ new(element: input_element, metadata: metadata).output
9
13
  rescue => e
10
14
  logger.error "[ERROR] #{e.class}: #{e}"
11
15
  "Parsing Error"
12
16
  end
13
17
 
14
18
  def self.parse_and_execute(target, values, metadata = {})
15
- parsed_target = parse(target, metadata)
19
+ parsed_target = parse(target, metadata, false)
16
20
  parsed_values = parse(values, metadata)
17
21
  MethodParser.parse(parsed_target, parsed_values)
18
22
  end
@@ -8,7 +8,7 @@ module Reportinator
8
8
  validates :target, presence: true
9
9
 
10
10
  def data
11
- self.target = ValueParser.parse(target, metadata)
11
+ self.target = ValueParser.parse(target, metadata, false)
12
12
  return Row.create(get_model_data(target)) unless target.respond_to? :each
13
13
  records_data.map { |data| Row.create(data) }
14
14
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Reportinator
4
- VERSION = "0.3.2"
4
+ VERSION = "0.3.4"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reportinator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Moxvallix
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-11-24 00:00:00.000000000 Z
11
+ date: 2022-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel