eco-helpers 2.0.26 → 2.0.31

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: 722e1dc695f9d9fae5fbceca8a2269f4836393ee4dc50fc0f850e43fefc88789
4
- data.tar.gz: bc34444cdf33bff51895fa5ed6bb7a89b89074e5bd11852c0a1a4f4bf6bcc574
3
+ metadata.gz: dd31d354667802423a4003fe347af67916015eaeac0d1682cbe511d7afc11b40
4
+ data.tar.gz: d0f9d23f2ad6db33861441d9f865a9e5925eec7a1e4042f7246bbded8f61ce6f
5
5
  SHA512:
6
- metadata.gz: 9a18aaa7abf012872f21209907909f1c309ddb530586bc9e27d595ace57377c3c4dba2b0a7bacc902e160cf2f51d4171a5de3e0536b6eda4dff7d018307744ca
7
- data.tar.gz: efcaa1832677c0cf13d5dfb0ba6a3abaa8bff3fec4e1d2639b2b832358a1e51b849e594da64827bed096eb4f8f03a5664a6a8245c58128acf3478eaf0e94d38a
6
+ metadata.gz: fafda0f2b9f6866499df3a641598800ea5dd2c2536710a759bbd0d30a307f36da8cc1cb30056de965134aea509ce1700df152d233d322b41c590048569ecd23e
7
+ data.tar.gz: d2f953274727fa35d8474da766dabee715f21b4ae227be9e0b4f31363d58fdcc1b0e410d10976b3f8608e14335d5f42c97dccd6a3d2e55ea37fb4a945d02d091
data/CHANGELOG.md CHANGED
@@ -1,7 +1,46 @@
1
1
  # Change Log
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
- ## [2.0.26] - 2021-06-xx
4
+ ## [2.0.31] - 2021-07-xx
5
+
6
+ ### Added
7
+
8
+ ### Changed
9
+
10
+ ### Fixed
11
+ - `Eco::API::Session::Batch::Job`: `include-excluded` was triggering a type error.
12
+
13
+ ## [2.0.30] - 2021-07-08
14
+
15
+ ### Added
16
+ * `Eco::API::Common::People::DefaultParsers::XLSParser` uses as default the `fields_map.json` to identify the headers.
17
+
18
+ ### Fixed
19
+ * `Eco::API::Common::People::DefaultParsers::XLSParser` should return all `String` values
20
+
21
+ ## [2.0.29] - 2021-07-08
22
+
23
+ ### Fixed
24
+ - `Eco::API::Common::People::PersonEntryAttributeMapper#details_attrs`
25
+ * What a mess this was doing to the `csv` export :/
26
+
27
+ ## [2.0.27] - 2021-07-05
28
+
29
+ ### Changed
30
+ - Parent class `Eco::API::UseCases::DefaultCases::ToCsvCase` shouldn't know header maps necessary for `Eco::API::UseCases::DefaultCases::ToCsvDetailedCase`
31
+ * Moved related header maps to `ToCsvDetailedCase`
32
+
33
+ ### Fixed
34
+ - `--help` should work fine now
35
+ - Attribute parsers that depended on indirect parser attributes were **not** included
36
+ - **changed** a couple of classes
37
+ - `Eco::API::Common::People::PersonEntryAttributeMapper`, where methods should receive `data` to re-scope if the data is available (most specifically `#internal_attrs`)
38
+ - `Eco::API::Common::People::PersonEntry`, where when setting the final values on `Person`, it should include any internal attribute that is present in the `final_entry` (the result of all the parsing process)
39
+ - `Eco::API::Common::People::DefaultParsers::CSVParser`
40
+ - indirect attributes that depended on other indirect attributes would show as missing even if they were active
41
+ - i.e. `name` depends on `first-name` & `surname`, **AND** `details-name` depends on `name`
42
+
43
+ ## [2.0.26] - 2021-06-25
5
44
 
6
45
  ### Added
7
46
  - `Eco::API::MicroCases#set_supervisor`, tries to keep in sync the `#subordinates` **count** of previous and new supervisor
@@ -49,9 +88,6 @@ All notable changes to this project will be documented in this file.
49
88
  * when in `dry-run` it fakes the `id` with a counter
50
89
  - `Eco::API::Common::People::PersonFactory` gets `subordinates` initialized to `0` (when **creating** a `new` person)
51
90
 
52
- ### Fixed
53
-
54
-
55
91
  ## [2.0.25] - 2021-06-23
56
92
 
57
93
  ### Added
@@ -5,7 +5,7 @@ module Eco
5
5
  class Base
6
6
  extend Eco::API::Common::ClassHelpers
7
7
 
8
- class << self
8
+ class << self
9
9
  # Sort order
10
10
  def <=>(other)
11
11
  created_at <=> other.created_at
@@ -70,20 +70,14 @@ class Eco::API::Common::People::DefaultParsers::CSVParser < Eco::API::Common::Lo
70
70
  end
71
71
 
72
72
  def missing_headers(headers)
73
- hint = headers & all_internal_attrs
74
- hext = headers - hint
75
- int_head = hint + hext.map {|e| fields_mapper.to_internal(e)}.compact
76
- known_as_int = known_headers.select do |e|
77
- i = fields_mapper.to_internal(e)
78
- int_head.include?(i)
79
- end
73
+ int_head = internal_present_or_active(headers)
80
74
  ext = headers.select do |e|
81
75
  i = fields_mapper.to_internal(e)
82
76
  int_head.include?(i)
83
77
  end
84
- ext_present = known_as_int | ext
78
+ ext_present = known_headers_present(int_head) | ext
85
79
  ext_miss = known_headers - ext_present
86
- #int_miss = ext_miss.map {|ext| fields_mapper.to_internal(ext)}
80
+
87
81
  ext_miss.each_with_object({}) do |ext, missing|
88
82
  next unless int = fields_mapper.to_internal(ext)
89
83
  if all_internal_attrs.include?(int)
@@ -91,7 +85,10 @@ class Eco::API::Common::People::DefaultParsers::CSVParser < Eco::API::Common::Lo
91
85
  missing[:direct] << ext
92
86
  end
93
87
  related_attrs_requirements = required_attrs.values.select do |req|
94
- req.dependant?(int) && !int_head.include?(req.attr)
88
+ dep = req.dependant?(int)
89
+ affects = dep && !int_head.include?(int)
90
+ in_header = int_head.include?(req.attr)
91
+ affects || (dep && !in_header)
95
92
  end
96
93
  next if related_attrs_requirements.empty?
97
94
  missing[:indirect] ||= {}
@@ -106,6 +103,41 @@ class Eco::API::Common::People::DefaultParsers::CSVParser < Eco::API::Common::Lo
106
103
  end
107
104
  end
108
105
 
106
+ def known_headers_present(headers_internal)
107
+ @known_internal ||= known_headers.select do |ext|
108
+ int = fields_mapper.to_internal(ext)
109
+ headers_internal.include?(int)
110
+ end
111
+ end
112
+
113
+ def internal_present_or_active(headers, inactive_requirements = {})
114
+ hint = headers & all_internal_attrs
115
+ hext = headers - hint
116
+ int_present = hint + hext.map {|e| fields_mapper.to_internal(e)}.compact
117
+
118
+ update_inactive = Proc.new do
119
+ inactive_requirements.dup.each do |attr, req|
120
+ if req.active?(*int_present)
121
+ inactive_requirements.delete(attr)
122
+ int_present << attr
123
+ update_inactive.call
124
+ end
125
+ end
126
+ end
127
+
128
+ required_attrs.values.each do |req|
129
+ next if int_present.include?(req)
130
+ if req.active?(*int_present)
131
+ inactive_requirements.delete(req.attr)
132
+ int_present << req.attr
133
+ update_inactive.call
134
+ else
135
+ inactive_requirements[req.attr] = req
136
+ end
137
+ end
138
+ int_present
139
+ end
140
+
109
141
  def known_headers
110
142
  @known_headers ||= fields_mapper.list(:external).compact
111
143
  end
@@ -121,7 +153,11 @@ class Eco::API::Common::People::DefaultParsers::CSVParser < Eco::API::Common::Lo
121
153
  end
122
154
 
123
155
  def all_internal_attrs
124
- person_parser.all_attrs(include_defined_parsers: true)
156
+ @all_internal_attrs ||= [].tap do |int_attrs|
157
+ known_int_attrs = person_parser.all_attrs(include_defined_parsers: true)
158
+ known_int_attrs |= fields_mapper.list(:internal).compact
159
+ int_attrs.concat(known_int_attrs)
160
+ end
125
161
  end
126
162
 
127
163
  def person_parser
@@ -6,7 +6,12 @@ class Eco::API::Common::People::DefaultParsers::XLSParser < Eco::API::Common::Lo
6
6
 
7
7
  def parser(file, deps)
8
8
  @file = file
9
- rows.tap {|r| @file = nil}
9
+ rows.tap do |rws|
10
+ @file = nil
11
+ rws.each do |row|
12
+ to_string!(row)
13
+ end
14
+ end
10
15
  end
11
16
 
12
17
  def serializer(array_hash, deps)
@@ -15,8 +20,18 @@ class Eco::API::Common::People::DefaultParsers::XLSParser < Eco::API::Common::Lo
15
20
 
16
21
  private
17
22
 
23
+ def to_string!(row)
24
+ row.transform_values! do |val|
25
+ next nil unless val
26
+ next val if val.is_a?(String)
27
+ val.to_s
28
+ end
29
+ end
30
+
31
+
18
32
  def headers
19
- raise "You should implement this method"
33
+ logger.warn("Headers detection is using your fields_map.json file (native behaviour)")
34
+ session.fields_mapper.list(:external).uniq
20
35
  end
21
36
 
22
37
  def sheet_name
@@ -34,7 +49,7 @@ class Eco::API::Common::People::DefaultParsers::XLSParser < Eco::API::Common::Lo
34
49
 
35
50
  def rows(target = headers)
36
51
  begin
37
- spreadheet.parse(header_search: target)
52
+ spreadheet.parse(header_search: target, clean: true)
38
53
  rescue Roo::HeaderRowNotFoundError => e
39
54
  missing = JSON.parse(e.message)
40
55
  logger.warn("The input file is missing these headers: #{missing}")
@@ -188,7 +188,7 @@ module Eco
188
188
  # @param person [Ecoportal::API::V1::Person] the person we want to set the core values to.
189
189
  # @param exclude [String, Array<String>] core attributes that should not be set/changed to the person.
190
190
  def set_core(person, exclude: nil)
191
- scoped_attrs = @emap.core_attrs - into_a(exclude)
191
+ scoped_attrs = @emap.core_attrs(@final_entry) - into_a(exclude)
192
192
  @final_entry.slice(*scoped_attrs).each do |attr, value|
193
193
  begin
194
194
  set_part(person, attr, value)
@@ -210,7 +210,7 @@ module Eco
210
210
  # @param exclude [String, Array<String>] account properties that should not be set/changed to the person.
211
211
  def set_account(person, exclude: nil)
212
212
  person.account = {} if !person.account
213
- scoped_attrs = @emap.account_attrs - into_a(exclude)
213
+ scoped_attrs = @emap.account_attrs(@final_entry) - into_a(exclude)
214
214
  @final_entry.slice(*scoped_attrs).each do |attr, value|
215
215
  set_part(person.account, attr, value)
216
216
  end
@@ -224,7 +224,7 @@ module Eco
224
224
  # @param exclude [String, Array<String>] schema field attributes that should not be set/changed to the person.
225
225
  def set_details(person, exclude: nil)
226
226
  person.add_details(@person_parser.schema) if !person.details || !person.details.schema_id
227
- scoped_attrs = @emap.details_attrs - into_a(exclude)
227
+ scoped_attrs = @emap.details_attrs(@final_entry) - into_a(exclude)
228
228
  @final_entry.slice(*scoped_attrs).each do |attr, value|
229
229
  set_part(person.details, attr, value)
230
230
  end
@@ -326,12 +326,13 @@ module Eco
326
326
  # @param internal_entry [Hash] the entry with the **internal** _attribute_ names and values but the **external** types.
327
327
  # @return [Hash] the `parsed entry` with the **internal** final attributes names, values and types.
328
328
  def _final_parsing(internal_entry)
329
- core_account = @emap.account_attrs + @emap.core_attrs
330
- core_account_hash = internal_entry.slice(*core_account).each_with_object({}) do |(attr, value), hash|
329
+ core_account_attrs = @emap.account_attrs(internal_entry) + @emap.core_attrs(internal_entry)
330
+ core_account_hash = internal_entry.slice(*core_account_attrs).each_with_object({}) do |(attr, value), hash|
331
331
  hash[attr] = _parse_type(attr, value)
332
332
  end
333
333
 
334
- details_hash = internal_entry.slice(*@emap.details_attrs).each_with_object({}) do |(attr, value), hash|
334
+ details_attrs = @emap.details_attrs(internal_entry)
335
+ details_hash = internal_entry.slice(*details_attrs).each_with_object({}) do |(attr, value), hash|
335
336
  hash[attr] = _parse_type(attr, value, schema: @person_parser.schema)
336
337
  end
337
338
 
@@ -3,18 +3,11 @@ module Eco
3
3
  module Common
4
4
  module People
5
5
 
6
- # @attr_reader core_attrs [Array<String>] core attributes that are present in the person entry.
7
- # @attr_reader details_attrs [Array<String>] schema details attributes that are present in the person entry.
8
- # @attr_reader account_attrs [Array<String>] account attributes that are present in the person entry.
9
- # @attr_reader all_model_attrs [Array<String>] all the attrs that are present in the person entry.
10
- # @attr_reader internal_attrs [Array<String>] all the internally named attributes that the person entry has.
11
- # @attr_reader aliased_attrs [Array<String>] only those internal attributes present in the person entry that have an internal/external name mapping.
12
6
  # @attr_reader direct_attrs [Array<String>] only those internal attributes present in the person entry that do **not** have an internal/external name mapping.
13
7
  class PersonEntryAttributeMapper
14
8
  @@cached_warnings = {}
15
9
 
16
- attr_reader :core_attrs, :details_attrs, :account_attrs, :all_model_attrs
17
- attr_reader :internal_attrs, :aliased_attrs, :direct_attrs
10
+ attr_reader :aliased_attrs, :direct_attrs
18
11
 
19
12
  # Helper class tied to `PersonEntry` that allows to track which attributes of a person entry are present
20
13
  # and how they should be mapped between internal and external names if applicable.
@@ -38,17 +31,64 @@ module Eco
38
31
 
39
32
  if parsing?
40
33
  @external_entry = data
41
- init_attr_trackers
42
34
  else # SERIALIZING
43
35
  @person = data
44
- @internal_attrs = @person_parser.all_model_attrs
45
- @aliased_attrs = @attr_map.list(:internal)
46
36
  end
37
+ end
47
38
 
48
- @core_attrs = @person_parser.target_attrs_core(@internal_attrs)
49
- @details_attrs = @person_parser.target_attrs_details(@internal_attrs)
50
- @account_attrs = @person_parser.target_attrs_account(@internal_attrs)
51
- @all_model_attrs = @core_attrs | @account_attrs | @details_attrs
39
+ # @return [Array<String>] only those internal attributes present in the person entry that have an internal/external name mapping.
40
+ def aliased_attrs
41
+ return @aliased_attrs unless !@aliased_attrs
42
+ if parsing?
43
+ init_attr_trackers
44
+ else
45
+ @aliased_attrs = @attr_map.list(:internal)
46
+ end
47
+ @aliased_attrs
48
+ end
49
+
50
+ # @return [Array<String>] all the internally named attributes that the person entry has.
51
+ def internal_attrs(data = nil)
52
+ return @internal_attrs unless data || !@internal_attrs
53
+ if parsing?
54
+ init_attr_trackers unless @internal_attrs
55
+ if data
56
+ return data.keys & @person_parser.all_model_attrs
57
+ end
58
+ else
59
+ @internal_attrs = @person_parser.all_model_attrs
60
+ end
61
+ @internal_attrs
62
+ end
63
+
64
+
65
+ # @return [Array<String>] all the attrs that are present in the person entry.
66
+ def all_model_attrs(data = nil)
67
+ core_attrs(data) | account_attrs(data) | details_attrs(data)
68
+ end
69
+
70
+ # @return [Array<String>] core attributes that are present in the person entry.
71
+ def core_attrs(data = nil)
72
+ return @core_attrs unless data || !@core_attrs
73
+ @person_parser.target_attrs_core(internal_attrs(data)).tap do |core_attrs|
74
+ @core_attrs ||= core_attrs
75
+ end
76
+ end
77
+
78
+ # @return [Array<String>] schema details attributes that are present in the person entry.
79
+ def details_attrs(data = nil)
80
+ return @details_attrs unless data || !@details_attrs
81
+ @person_parser.target_attrs_details(internal_attrs(data)).tap do |details_attrs|
82
+ @details_attrs ||= details_attrs
83
+ end
84
+ end
85
+
86
+ # @return [Array<String>] account attributes that are present in the person entry.
87
+ def account_attrs(data = nil)
88
+ return @account_attrs unless data || !@account_attrs
89
+ @person_parser.target_attrs_account(internal_attrs(data)).tap do |account_attrs|
90
+ @account_attrs ||= account_attrs
91
+ end
52
92
  end
53
93
 
54
94
  # To know if currently the object is in parse or serialize mode.
@@ -151,7 +191,6 @@ module Eco
151
191
  def_unlinked = @person_parser.undefined_model_attrs.select { |attr| !to_external(attr) }
152
192
  # (def) those with parser or alias:
153
193
  def_linked = def_all_attrs - def_unlinked
154
-
155
194
  # (data) data attributes (actual attributes of the entry)
156
195
  data_attrs = attributes(@external_entry)
157
196
  # (data) attributes of the data that come directly as internal attribute names
@@ -253,7 +253,8 @@ module Eco
253
253
  def api_included(full_queue)
254
254
  return full_queue if type == :create
255
255
  return full_queue unless excluded = session.config.people.api_excluded
256
- if options.dig(:include, :excluded, :only)
256
+ excluded = options.dig(:include, :excluded)
257
+ if excluded.is_a?(Hash) && excluded[:only]
257
258
  full_queue.select {|entry| excluded.call(entry, session, options, self)}
258
259
  elsif options.dig(:include, :excluded)
259
260
  full_queue
@@ -125,43 +125,7 @@ class Eco::API::UseCases::DefaultCases::ToCsvCase < Eco::API::Common::Loaders::U
125
125
  "id" => "ecoPortal ID",
126
126
  "external_id" => "Reference ID (ext_id)",
127
127
  "login_provider_ids" => "Login Methods",
128
- "landing_page_id" => "Landing Page ID",
129
- "show_sidebar" => "(pref) Sidebar Open?",
130
- "show_shortcuts" => "(pref) Link to Registers?",
131
- "show_coming_soon" => "(pref) Coming Soon List?",
132
- "show_recently_visited_forms" => "(pref) Recently Visited Forms List?",
133
- "show_tasks" => "(pref) Tasks List?",
134
- "show_task_bubbles" => "(pref) Task Count Bubbles",
135
- "kiosk_enabled" => "Kiosk User?",
136
- "freemium" => "Freemium User?",
137
- "files" => "(able) on Files",
138
- "reports" => "(able) on Report Structures",
139
- "data" => "(able) on Data (hours, datasets)",
140
- "organization" => "(able) on Organization Config",
141
- "pages" => "(able) on Page/Entries",
142
- "page_editor" => "(able) page Editor Level",
143
- "registers" => "(able) on Registers",
144
- "tasks" => "(able) on Tasks",
145
- "person_core" => "(able) on People",
146
- "person_core_create" => "(able) Create People?",
147
- "person_core_edit" => "(able) Edit People?",
148
- "person_details" => "(able) on People Schema Details",
149
- "person_account" => "(able) on Users",
150
- "person_abilities" => "(able) on Users' Abilities",
151
- "custom_files" => "(min) on Files",
152
- "custom_reports" => "(min) on Report Structures",
153
- "custom_data" => "(min) on Data (hours, datasets)",
154
- "custom_organization" => "(min) on Organization Config",
155
- "custom_pages" => "(min) on Page/Entries",
156
- "custom_page_editor" => "(min) page Editor Level",
157
- "custom_registers" => "(min) on Registers",
158
- "custom_tasks" => "(min) on Tasks",
159
- "custom_person_core" => "(min) on People",
160
- "custom_person_core_create" => "(min) Create People?",
161
- "custom_person_core_edit" => "(min) Edit People?",
162
- "custom_person_details" => "(min) on People Schema Details",
163
- "custom_person_account" => "(min) on Users",
164
- "custom_person_abilities" => "(min) on Users' Abilities"
128
+ "landing_page_id" => "Landing Page ID"
165
129
  }
166
130
  end
167
131
 
@@ -75,4 +75,46 @@ class Eco::API::UseCases::DefaultCases::ToCsvDetailedCase < Eco::API::UseCases::
75
75
  ]
76
76
  end
77
77
 
78
+ def nice_header_maps
79
+ @nice_header_maps ||= super.merge({
80
+ "landing_page_id" => "Landing Page ID",
81
+ "show_sidebar" => "(pref) Sidebar Open?",
82
+ "show_shortcuts" => "(pref) Link to Registers?",
83
+ "show_coming_soon" => "(pref) Coming Soon List?",
84
+ "show_recently_visited_forms" => "(pref) Recently Visited Forms List?",
85
+ "show_tasks" => "(pref) Tasks List?",
86
+ "show_task_bubbles" => "(pref) Task Count Bubbles",
87
+ "kiosk_enabled" => "Kiosk User?",
88
+ "freemium" => "Freemium User?",
89
+ "files" => "(able) on Files",
90
+ "reports" => "(able) on Report Structures",
91
+ "data" => "(able) on Data (hours, datasets)",
92
+ "organization" => "(able) on Organization Config",
93
+ "pages" => "(able) on Page/Entries",
94
+ "page_editor" => "(able) page Editor Level",
95
+ "registers" => "(able) on Registers",
96
+ "tasks" => "(able) on Tasks",
97
+ "person_core" => "(able) on People",
98
+ "person_core_create" => "(able) Create People?",
99
+ "person_core_edit" => "(able) Edit People?",
100
+ "person_details" => "(able) on People Schema Details",
101
+ "person_account" => "(able) on Users",
102
+ "person_abilities" => "(able) on Users' Abilities",
103
+ "custom_files" => "(min) on Files",
104
+ "custom_reports" => "(min) on Report Structures",
105
+ "custom_data" => "(min) on Data (hours, datasets)",
106
+ "custom_organization" => "(min) on Organization Config",
107
+ "custom_pages" => "(min) on Page/Entries",
108
+ "custom_page_editor" => "(min) page Editor Level",
109
+ "custom_registers" => "(min) on Registers",
110
+ "custom_tasks" => "(min) on Tasks",
111
+ "custom_person_core" => "(min) on People",
112
+ "custom_person_core_create" => "(min) Create People?",
113
+ "custom_person_core_edit" => "(min) Edit People?",
114
+ "custom_person_details" => "(min) on People Schema Details",
115
+ "custom_person_account" => "(min) on Users",
116
+ "custom_person_abilities" => "(min) on Users' Abilities"
117
+ })
118
+ end
119
+
78
120
  end
@@ -2,7 +2,12 @@ ASSETS.cli.config do |cnf|
2
2
  cnf.options_set do |options_set, options|
3
3
  options_set.add("--help", "Offers a HELP") do |options, sesssion|
4
4
  conf = ASSETS.cli.config
5
- active = Proc.new {|opt| SCR.get_arg(opt) && SCR.get_arg(opt, with_param: true)}
5
+ active = Proc.new do |opt|
6
+ if there = SCR.get_arg(opt)
7
+ refine = SCR.get_arg(opt, with_param: true)
8
+ end
9
+ refine || there
10
+ end
6
11
 
7
12
  if hpf = active.call("-filters")
8
13
  puts conf.people_filters.help(refine: hpf)
@@ -18,7 +18,7 @@ module Eco
18
18
  [msg].yield_self do |lines|
19
19
  max_len = keys_max_len(@filters.keys)
20
20
  @filters.keys.sort.select do |key|
21
- refine.is_a?(String) && key.include?(refine)
21
+ !refine.is_a?(String) || key.include?(refine)
22
22
  end.each do |key|
23
23
  lines << help_line(key, @description[key], max_len)
24
24
  end
@@ -25,7 +25,7 @@ module Eco
25
25
  str_indent = is_general ? "" : " " * indent
26
26
  lines << help_line(namespace, "", max_len) unless is_general
27
27
  options_set(namespace).select do |arg, option|
28
- refine.is_a?(String) && option.name.include?(refine)
28
+ !refine.is_a?(String) || option.name.include?(refine)
29
29
  end.each do |arg, option|
30
30
  lines << help_line(" " * indent + "#{option.name}", option.description, max_len)
31
31
  end
@@ -34,7 +34,7 @@ module Eco
34
34
  ["The following are the available use cases#{refinement}:"].yield_self do |lines|
35
35
  max_len = keys_max_len(@linked_cases.keys)
36
36
  @linked_cases.keys.sort.select do |key|
37
- refine.is_a?(String) && key.include?(refine)
37
+ !refine.is_a?(String) || key.include?(refine)
38
38
  end.each do |option_case|
39
39
  lines << help_line(option_case, @linked_cases[option_case].description, max_len)
40
40
  end
data/lib/eco/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Eco
2
- VERSION = "2.0.26"
2
+ VERSION = "2.0.31"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eco-helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.26
4
+ version: 2.0.31
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oscar Segura