effective_resources 2.7.3 → 2.7.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5e36a25d824db2b9794dd755ee4311385e59e0061448ce72f6e018c37ae2dc09
4
- data.tar.gz: a9ac9af3756f705d50a545810e22e5179f2febdd9754fbbdf2e0b825e12bc149
3
+ metadata.gz: 81e95260653fd5965100cb1472f50ed8d5132c1fb37574b8f726c62fbb6b7788
4
+ data.tar.gz: 8a17f54272e74b3ffdeb7ecd14651d6506cb1f4051e15c30429064ca7df02ee9
5
5
  SHA512:
6
- metadata.gz: 6acf08c36bf3ce4c15c225a1605594d1d2e6b19c20c3cb199bb13e9f312ce8a0edaff5c8665811c71491802c5a53cee2f6dab383e92de4485a8217c9eb4f9004
7
- data.tar.gz: b94c04b3a8e3512af8f3f554091b604f2317511e9575900d3c8fc541a56b16729f620e02a5ad60b8b3b598a1bee4cdd9a2fb94d7597e4330af87ec10503b4dc4
6
+ metadata.gz: 2fd66ded174e4688bd8a432da093828e7f58444269b3ac40a9fb44cd545792137f6942a57d5cfa8190f04e375979ffe345e3800e90b9218e3121a7084b41626d
7
+ data.tar.gz: d9af4ef456b4de382ff1e947f432e2aa676dc56dfa0ec418735051b9b1bbcffe89c27c82d0613324c79a3829dccecca68720ef2e8052257205954bd6f6d021a2
@@ -76,6 +76,9 @@ module ActsAsStatused
76
76
  # was_approved?
77
77
  define_method("was_#{sym}?") { send(sym_at).present? }
78
78
 
79
+ # just_approved?
80
+ define_method("just_#{sym}?") { status == sym.to_s && status_was != sym.to_s }
81
+
79
82
  # approved_at
80
83
  define_method(sym_at) { self[sym_at.to_s] || status_steps[sym_at] }
81
84
 
@@ -57,6 +57,10 @@ module ActsAsWizard
57
57
  self.class.const_get(:WIZARD_STEPS).keys
58
58
  end
59
59
 
60
+ def all_steps
61
+ wizard_step_keys
62
+ end
63
+
60
64
  def completed_steps
61
65
  wizard_steps.keys
62
66
  end
@@ -89,7 +93,7 @@ module ActsAsWizard
89
93
  # For use in the summary partials. Does not include summary.
90
94
  def render_steps
91
95
  blacklist = [:start, :billing, :checkout, :submitted, :summary]
92
- (required_steps + completed_steps - blacklist).select { |step| has_completed_step?(step) }
96
+ ((required_steps | completed_steps) - blacklist).select { |step| has_completed_step?(step) }
93
97
  end
94
98
 
95
99
  def wizard_step_title(step)
@@ -29,6 +29,10 @@ module Effective
29
29
  end
30
30
  end
31
31
 
32
+ def belong_tos_names_attributes
33
+ belong_tos.inject({}) { |h, ass| h[ass.name] = [:belongs_to]; h }
34
+ end
35
+
32
36
  def has_manys_attributes
33
37
  has_manys_ids.inject({}) { |h, ass| h[ass] = [:array]; h }
34
38
  end
@@ -82,6 +86,7 @@ module Effective
82
86
  end
83
87
 
84
88
  # All table attributes. includes primary_key and belongs_tos
89
+ # THINK THIS IS DEPRECATED
85
90
  def table_attributes
86
91
  attributes = (klass.new().attributes rescue nil)
87
92
  return {} unless attributes
@@ -123,6 +128,14 @@ module Effective
123
128
  sort ? sort_by_model_attributes(attributes) : attributes
124
129
  end
125
130
 
131
+ # Similar to klass_attributes
132
+ # Used by table_builder
133
+ def resource_attributes
134
+ belong_tos_names_attributes
135
+ .merge(klass_attributes(sort: true))
136
+ .merge(effective_addresses_attributes)
137
+ end
138
+
126
139
  private
127
140
 
128
141
  def sort_by_model_attributes(attributes)
@@ -1,3 +1,3 @@
1
1
  module EffectiveResources
2
- VERSION = '2.7.3'.freeze
2
+ VERSION = '2.7.5'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_resources
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.3
4
+ version: 2.7.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-18 00:00:00.000000000 Z
11
+ date: 2023-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails