card 1.101.4 → 1.101.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.
Files changed (216) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/config/i18n-tasks.yml +0 -5
  4. data/config/initializers/01_core_extensions/array.rb +2 -1
  5. data/config/initializers/01_core_extensions/hash.rb +1 -0
  6. data/config/initializers/01_core_extensions/object.rb +15 -11
  7. data/config/initializers/02_patches/active_job.rb +1 -1
  8. data/config/initializers/02_patches/active_record.rb +1 -3
  9. data/config/initializers/02_patches/better_errors.rb +1 -3
  10. data/config/initializers/02_patches/kaminari.rb +2 -2
  11. data/config/initializers/deck_config.rb +1 -1
  12. data/config/initializers/inflections.rb +1 -0
  13. data/config/initializers/internationalization.rb +23 -21
  14. data/config/initializers/mime_types.rb +1 -0
  15. data/config/initializers/notification.rb +1 -0
  16. data/config/initializers/patches.rb +6 -5
  17. data/config/locales/en.yml +10 -16
  18. data/db/migrate/20110511221913_require_earlier_migrations.rb +1 -0
  19. data/db/migrate/20121111025347_require_1_10_migrations.rb +1 -0
  20. data/db/migrate/20121118114000_split_link_type.rb +1 -0
  21. data/db/migrate/20121118115000_update_link_type.rb +1 -0
  22. data/db/migrate/20130106052640_table_cleanup.rb +2 -2
  23. data/db/migrate/20130109015336_trunk_left.rb +1 -0
  24. data/db/migrate/20130411210957_update_codenames.rb +1 -0
  25. data/db/migrate/20140822073704_create_new_revision_tables.rb +1 -0
  26. data/db/migrate/20141001105348_move_revisions_to_actions.rb +9 -3
  27. data/db/migrate/20141216053032_better_index_names.rb +9 -6
  28. data/db/migrate/20170908114442_create_delayed_jobs.rb +1 -1
  29. data/db/migrate/20170908114452_increase_text_size_for_delayed_jobs.rb +1 -1
  30. data/db/migrate/20180514152037_add_card_virtuals_table.rb +1 -1
  31. data/db/migrate_core_cards/20120611203506_rails_inflection_updates.rb +2 -1
  32. data/db/migrate_core_cards/20130411191151_renaming_for_menu.rb +9 -9
  33. data/db/migrate_core_cards/20130419215612_import_help_text.rb +3 -2
  34. data/db/migrate_core_cards/20130823192433_add_style_cards.rb +5 -5
  35. data/db/migrate_core_cards/20130910183318_move_styles_to_content.rb +3 -2
  36. data/db/migrate_core_cards/20130920291703_update_stylesheets.rb +2 -4
  37. data/db/migrate_core_cards/20131016172445_common_css_patch.rb +1 -3
  38. data/db/migrate_core_cards/20140110193325_reset_account_request_type.rb +1 -3
  39. data/db/migrate_core_cards/20140307231621_user_data_to_cards.rb +12 -8
  40. data/db/migrate_core_cards/20140317035504_account_requests_to_signups.rb +2 -4
  41. data/db/migrate_core_cards/20140512155840_add_script_cards.rb +16 -9
  42. data/db/migrate_core_cards/20140629222005_add_email_cards.rb +19 -11
  43. data/db/migrate_core_cards/20140725180118_config_card_updates.rb +1 -1
  44. data/db/migrate_core_cards/20141115034214_config_descriptions_etc.rb +1 -1
  45. data/db/migrate_core_cards/20141119001955_make_symlinks_relative.rb +1 -1
  46. data/db/migrate_core_cards/20141204061304_watchers_to_following.rb +2 -0
  47. data/db/migrate_core_cards/20141216155251_add_more_following_cards.rb +4 -2
  48. data/db/migrate_core_cards/20150202143810_import_bootstrap_layout.rb +1 -1
  49. data/db/migrate_core_cards/20150220134731_following_to_follow_rule.rb +3 -4
  50. data/db/migrate_core_cards/20150317162412_bootstrap_themes.rb +8 -4
  51. data/db/migrate_core_cards/20150326205655_bootswatch_themes.rb +14 -7
  52. data/db/migrate_core_cards/20150429090551_search_card_context.rb +6 -4
  53. data/db/migrate_core_cards/20150508212032_menu_compatibility.rb +4 -2
  54. data/db/migrate_core_cards/20150510031118_fix_skin_codenames.rb +2 -1
  55. data/db/migrate_core_cards/20150601133433_add_recent_setting_session_card.rb +3 -3
  56. data/db/migrate_core_cards/20150610171702_add_debugger_session_card.rb +2 -1
  57. data/db/migrate_core_cards/20150610180019_add_recaptcha_key_and_admin_info_cards.rb +4 -3
  58. data/db/migrate_core_cards/20150724123438_update_file_and_image_cards.rb +6 -2
  59. data/db/migrate_core_cards/20150807205221_create_references_for_search_cards.rb +1 -1
  60. data/db/migrate_core_cards/20150824135418_update_file_history.rb +2 -0
  61. data/db/migrate_core_cards/20160804112510_reorganize_scripts.rb +1 -1
  62. data/db/migrate_core_cards/20160811115836_rename_stats_to_admin.rb +1 -0
  63. data/db/migrate_core_cards/20160914132636_fix_mod_files.rb +2 -0
  64. data/db/migrate_core_cards/20161102202156_tweak_recaptcha_setting_cards.rb +6 -6
  65. data/db/migrate_core_cards/20161103154836_update_keys.rb +2 -1
  66. data/db/migrate_core_cards/20170209132834_email_test_context.rb +2 -0
  67. data/db/migrate_core_cards/20170314175313_add_notification_event_card.rb +3 -3
  68. data/db/migrate_core_cards/20170515101262_add_advanced_edit_cards.rb +1 -1
  69. data/db/migrate_core_cards/20170608200649_add_input_options_codename.rb +1 -1
  70. data/db/migrate_core_cards/20180712042655_head_rule.rb +3 -4
  71. data/db/migrate_core_cards/20180905061537_migrate_layouts.rb +4 -4
  72. data/db/migrate_core_cards/20181120200937_update_layout.rb +1 -1
  73. data/db/migrate_core_cards/20190320091257_upgrade_recaptcha_to_v3.rb +7 -7
  74. data/db/migrate_core_cards/20190424100531_update_credit_image.rb +1 -0
  75. data/db/migrate_core_cards/20190502130029_add_shark_and_help_desk_role.rb +15 -14
  76. data/db/migrate_core_cards/20190503122739_update_pristine_data.rb +1 -1
  77. data/db/migrate_core_cards/20190625153616_pointer_overhaul.rb +9 -5
  78. data/db/migrate_core_cards/20190718140126_add_guides.rb +3 -3
  79. data/db/migrate_core_cards/20190822093633_move_help_text_to_code.rb +1 -2
  80. data/db/migrate_core_cards/20190823220018_cleanup_for_decko_1_0.rb +1 -1
  81. data/db/migrate_core_cards/20190829093961_cardtype_grouping.rb +7 -7
  82. data/db/migrate_core_cards/20190902193208_input_type.rb +1 -3
  83. data/db/migrate_core_cards/20190909104250_add_cardtype_input_types.rb +2 -2
  84. data/db/migrate_core_cards/20191028135243_add_link_editor_to_tiny_mce_config.rb +1 -0
  85. data/db/migrate_core_cards/20191115160748_history_cleanup.rb +0 -1
  86. data/db/migrate_core_cards/20191118145629_codename_fixes.rb +1 -2
  87. data/db/migrate_core_cards/20200821231558_add_nest_list_type.rb +1 -1
  88. data/db/seed/new/card_actions.yml +2153 -2145
  89. data/db/seed/new/card_acts.yml +3 -3
  90. data/db/seed/new/card_references.yml +900 -858
  91. data/db/seed/new/cards.yml +4869 -4848
  92. data/db/seed/new/schema_migrations_deck_cards.yml +2 -0
  93. data/db/seed/test/fixtures/card_actions.yml +3563 -3547
  94. data/db/seed/test/fixtures/card_acts.yml +675 -675
  95. data/db/seed/test/fixtures/card_changes.yml +103 -103
  96. data/db/seed/test/fixtures/card_references.yml +2165 -2123
  97. data/db/seed/test/fixtures/cards.yml +7862 -7751
  98. data/db/seed/test/fixtures/schema_migrations_deck_cards.yml +2 -0
  99. data/db/test_seed.rb +33 -34
  100. data/lib/card.rb +1 -0
  101. data/lib/card/auth/token.rb +2 -2
  102. data/lib/card/cache.rb +2 -1
  103. data/lib/card/cache/all.rb +5 -0
  104. data/lib/card/cache/card_class.rb +3 -0
  105. data/lib/card/codename.rb +1 -1
  106. data/lib/card/content.rb +4 -8
  107. data/lib/card/content/chunk.rb +1 -1
  108. data/lib/card/content/clean.rb +4 -3
  109. data/lib/card/content/diff.rb +3 -2
  110. data/lib/card/content/diff/l_c_s/processor.rb +1 -1
  111. data/lib/card/content/diff/result.rb +1 -0
  112. data/lib/card/content/parser.rb +2 -2
  113. data/lib/card/content/truncate.rb +6 -6
  114. data/lib/card/director.rb +1 -1
  115. data/lib/card/director/all.rb +2 -2
  116. data/lib/card/director/card_methods.rb +1 -0
  117. data/lib/card/director/event_delay.rb +4 -6
  118. data/lib/card/director/run.rb +2 -0
  119. data/lib/card/director/stages.rb +3 -2
  120. data/lib/card/env/location.rb +4 -3
  121. data/lib/card/fetch.rb +7 -4
  122. data/lib/card/fetch/all.rb +1 -0
  123. data/lib/card/fetch/card_class.rb +35 -27
  124. data/lib/card/fetch/results.rb +9 -0
  125. data/lib/card/fetch/retrieve.rb +2 -0
  126. data/lib/card/fetch/store.rb +1 -0
  127. data/lib/card/format/content.rb +1 -3
  128. data/lib/card/format/error.rb +6 -1
  129. data/lib/card/format/method_delegation.rb +10 -2
  130. data/lib/card/format/nest.rb +2 -1
  131. data/lib/card/format/nest/fetch.rb +2 -0
  132. data/lib/card/format/nesting/mode.rb +1 -1
  133. data/lib/card/format/nesting/subformat.rb +2 -1
  134. data/lib/card/format/render.rb +2 -2
  135. data/lib/card/format/wrapper.rb +1 -1
  136. data/lib/card/lexicon.rb +3 -2
  137. data/lib/card/mark.rb +17 -15
  138. data/lib/card/model/save_helper.rb +3 -3
  139. data/lib/card/name.rb +10 -9
  140. data/lib/card/name/all.rb +3 -0
  141. data/lib/card/name/all/descendants.rb +3 -4
  142. data/lib/card/name/card_class.rb +2 -0
  143. data/lib/card/name/fields_and_traits.rb +4 -2
  144. data/lib/card/name/name_variants.rb +0 -1
  145. data/lib/card/query.rb +17 -17
  146. data/lib/card/query/card_query/interpretation.rb +1 -0
  147. data/lib/card/query/card_query/match_attributes.rb +2 -1
  148. data/lib/card/query/card_query/normalization.rb +1 -0
  149. data/lib/card/query/card_query/reference_attributes.rb +1 -1
  150. data/lib/card/query/join.rb +1 -1
  151. data/lib/card/query/value/match_value.rb +1 -0
  152. data/lib/card/reference/all.rb +7 -2
  153. data/lib/card/rule/all.rb +1 -0
  154. data/lib/card/rule/cache.rb +2 -0
  155. data/lib/card/set/advanced_api.rb +3 -2
  156. data/lib/card/set/event.rb +2 -2
  157. data/lib/card/set/event/all.rb +6 -0
  158. data/lib/card/set/event/delayed_event.rb +6 -6
  159. data/lib/card/set/event/options.rb +1 -0
  160. data/lib/card/set/format/abstract_format/view_definition.rb +1 -0
  161. data/lib/card/set/format/abstract_format/view_opts.rb +1 -0
  162. data/lib/card/set/i18n_scope.rb +4 -2
  163. data/lib/card/set/inheritance.rb +0 -1
  164. data/lib/card/set/loader.rb +0 -2
  165. data/lib/card/set/pattern/base.rb +3 -2
  166. data/lib/card/set/pattern/class_methods.rb +2 -2
  167. data/lib/card/set/required_field.rb +4 -1
  168. data/lib/card/setting.rb +3 -0
  169. data/lib/card/subcards.rb +3 -4
  170. data/lib/card/tasks/card/file_card_creator/abstract_file_card/ruby_file.rb +1 -1
  171. data/lib/card/tasks/card/file_card_creator/output_helper.rb +2 -4
  172. data/lib/card/tasks/card/migrate.rake +2 -2
  173. data/lib/card/view/cache.rb +6 -8
  174. data/lib/card/view/cache/cache_action.rb +1 -2
  175. data/lib/card/view/cache/stub.rb +1 -1
  176. data/lib/card/view/options.rb +3 -3
  177. data/lib/card/view/permission.rb +1 -0
  178. data/lib/cardio.rb +1 -1
  179. data/lib/cardio/migration.rb +1 -1
  180. data/lib/cardio/migration/deck_structure.rb +2 -4
  181. data/lib/cardio/migration/import.rb +2 -2
  182. data/lib/cardio/migration/import/import_data.rb +1 -0
  183. data/lib/cardio/mod.rb +1 -0
  184. data/lib/cardio/mod/load_strategy.rb +2 -4
  185. data/lib/cardio/mod/loader/set_loader.rb +2 -1
  186. data/lib/cardio/mod/module_template.rb +1 -0
  187. data/lib/cardio/modfiles.rb +2 -4
  188. data/lib/cardio/schema.rb +2 -4
  189. data/lib/cardio/utils.rb +1 -0
  190. data/lib/generators/card/format/format_generator.rb +1 -1
  191. data/lib/generators/card/migration/migration_generator.rb +2 -1
  192. data/lib/generators/card/mod/mod_generator.rb +3 -2
  193. data/lib/generators/card/set/set_generator.rb +3 -3
  194. data/lib/generators/card/template/template_generator.rb +1 -1
  195. data/mod/admin/set/self/admin.rb +6 -3
  196. data/mod/admin/set/self/trash.rb +1 -0
  197. data/mod/admin/spec/set/self/admin_spec.rb +4 -4
  198. data/mod/core/set/all/abort.rb +5 -5
  199. data/mod/core/set/all/assign_attributes.rb +5 -8
  200. data/mod/core/set/all/codename.rb +1 -0
  201. data/mod/core/set/all/collection.rb +4 -6
  202. data/mod/core/set/all/content.rb +3 -2
  203. data/mod/core/set/all/contextual_content.rb +2 -4
  204. data/mod/core/set/all/name_events.rb +13 -6
  205. data/mod/core/set/all/reference_events.rb +2 -0
  206. data/mod/core/set/all/states.rb +3 -3
  207. data/mod/core/set/all/subcards.rb +1 -1
  208. data/mod/core/set/all/trash.rb +5 -1
  209. data/mod/core/set/all/type.rb +4 -2
  210. data/mod/core/set/all/utils.rb +1 -1
  211. data/mod/core/spec/set/all/assign_attributes_spec.rb +10 -9
  212. data/mod/core/spec/set/all/clean_me_spec.rb +19 -4
  213. data/mod/core/spec/set/all/collection_spec.rb +1 -1
  214. data/mod/core/spec/set/all/export_spec.rb +1 -0
  215. data/mod/core/spec/set/all/initialize_spec.rb +11 -11
  216. metadata +4 -4
@@ -1,3 +1,5 @@
1
1
  ---
2
2
  schema_migrations_deck_cards_001:
3
3
  version: '20150116220621'
4
+ schema_migrations_deck_cards_002:
5
+ version: '20210504195646'
data/db/test_seed.rb CHANGED
@@ -12,10 +12,9 @@ class SharedData
12
12
  "Big Brother", "Optic fan", "Sunglasses fan", "Narcissist"
13
13
  ].freeze
14
14
 
15
- CARDTYPE_COUNT = 43
15
+ CARDTYPE_COUNT = 44
16
16
 
17
17
  class << self
18
-
19
18
  def create_user name, args
20
19
  args[:subcards] = account_args args if args[:email]
21
20
 
@@ -46,9 +45,10 @@ class SharedData
46
45
  # CREATE A CARD OF EACH TYPE
47
46
 
48
47
  no_samples = %w[user sign_up set number mirror_list mirrored_list file image
49
- customized_bootswatch_skin]
48
+ customized_bootswatch_skin alias]
50
49
  Card::Auth.createable_types.each do |type|
51
50
  next if no_samples.include? type.to_name.key
51
+
52
52
  create type: type, name: "Sample #{type}"
53
53
  end
54
54
 
@@ -57,7 +57,7 @@ class SharedData
57
57
  end
58
58
 
59
59
  create_layout_type "lay out", "Greatest {{_main|title: Callahan!; view: labeled}}"
60
- create_pointer "stacks", ["horizontal", "vertical"]
60
+ create_pointer "stacks", %w[horizontal vertical]
61
61
  create_pointer "stacks+*self+*layout", "lay out"
62
62
  create "horizontal"
63
63
  create_pointer "vertical"
@@ -75,7 +75,7 @@ class SharedData
75
75
  ["Z", "I'm here to be referenced to"],
76
76
  ["A", "Alpha [[Z]]"],
77
77
  ["B", "Beta {{Z}}"],
78
- ["T", "Theta"],
78
+ %w[T Theta],
79
79
  ["X", "[[A]] [[A+B]] [[T]]"],
80
80
  ["Y", "{{B}} {{A+B}} {{A}} {{T}}"],
81
81
  ["A+B", "AlphaBeta"],
@@ -114,7 +114,8 @@ class SharedData
114
114
  ## --------- Fruit: creatable by anyone but not readable ---
115
115
  Card.create! type: "Cardtype", name: "Fruit"
116
116
  Card.create! name: "Fruit+*type+*create", type: "Pointer", content: "[[Anyone]]"
117
- Card.create! name: "Fruit+*type+*read", type: "Pointer", content: "[[Administrator]]"
117
+ Card.create! name: "Fruit+*type+*read", type: "Pointer",
118
+ content: "[[Administrator]]"
118
119
 
119
120
  # codenames for card_accessor tests
120
121
  Card.create! name: "*write", codename: :write
@@ -158,7 +159,7 @@ class SharedData
158
159
 
159
160
  def user_and_role_cards
160
161
  # Card::Auth.instant_account_activation do
161
- create_user "Joe Admin", content: "I'm number one", email: "joe@admin.com"
162
+ create_user "Joe Admin", content: "I'm number one", email: "joe@admin.com"
162
163
  create_user "Joe User", content: "I'm number two", email: "joe@user.com"
163
164
  create_user "Joe Camel", content: "Mr. Buttz", email: "joe@camel.com"
164
165
 
@@ -169,10 +170,10 @@ class SharedData
169
170
 
170
171
  # noinspection RubyResolve
171
172
  Card["Joe Admin"].fetch(:roles, new: { type_code: "pointer" })
172
- .items = [Card::AdministratorID, Card::SharkID, Card::HelpDeskID]
173
+ .items = [Card::AdministratorID, Card::SharkID, Card::HelpDeskID]
173
174
 
174
175
  Card["Joe User"].fetch(:roles, new: { type_code: "pointer" })
175
- .items = [Card::SharkID]
176
+ .items = [Card::SharkID]
176
177
 
177
178
  create_user "u1", email: "u1@user.com", password: "u1_pass"
178
179
  create_user "u2", email: "u2@user.com", password: "u2_pass"
@@ -188,19 +189,18 @@ class SharedData
188
189
  Card["u3"].fetch(:roles, new: {}).items = [r1, r4, Card::AdministratorID]
189
190
  end
190
191
 
191
-
192
192
  def cardtype_cards
193
193
  # for cql & permissions
194
- %w[A+C A+D A+E C+A D+A F+A A+B+C].each {|name| create name}
194
+ %w[A+C A+D A+E C+A D+A F+A A+B+C].each { |name| create name }
195
195
  ("A".."F").each do |ch|
196
196
  create "Cardtype #{ch}", type_code: "cardtype",
197
- codename: "cardtype_#{ch.downcase}"
197
+ codename: "cardtype_#{ch.downcase}"
198
198
  end
199
199
  Card::Codename.reset_cache
200
200
 
201
201
  ("a".."f").each do |ch|
202
202
  create "type-#{ch}-card", type_code: "cardtype_#{ch}",
203
- content: "type_#{ch}_content"
203
+ content: "type_#{ch}_content"
204
204
  end
205
205
 
206
206
  create_pointer "Cardtype B+*type+*create", "[[r3]]"
@@ -210,7 +210,6 @@ class SharedData
210
210
  create "Cardtype E+*type+*default"
211
211
  end
212
212
 
213
-
214
213
  def notification_cards
215
214
  Timecop.freeze(Cardio.future_stamp - 1.day) do
216
215
  # fwiw Timecop is apparently limited by ruby Time object,
@@ -231,7 +230,7 @@ class SharedData
231
230
 
232
231
  followers.each do |name, _follow|
233
232
  create_user name, email: "#{name.parameterize}@user.com",
234
- password: "#{name.parameterize}_pass"
233
+ password: "#{name.parameterize}_pass"
235
234
  end
236
235
 
237
236
  create "All Eyes On Me"
@@ -252,7 +251,8 @@ class SharedData
252
251
 
253
252
  Card::Auth.signin Card::WagnBotID
254
253
  create "Google glass+*self+*follow_fields", ""
255
- create "Sunglasses+*self+*follow_fields", "[[#{:nests.cardname}]]\n[[_self+price]]\n[[_self+producer]]"
254
+ create "Sunglasses+*self+*follow_fields",
255
+ "[[#{:nests.cardname}]]\n[[_self+price]]\n[[_self+producer]]"
256
256
  create "Sunglasses+tint"
257
257
  create "Sunglasses+price"
258
258
 
@@ -277,7 +277,7 @@ class SharedData
277
277
  ["card with fields", "field 1", "field 2"],
278
278
  ["card with fields and admin fields", "field 1", "admin field 1"],
279
279
  ["admin card with fields and admin fields", "field 1", "admin field 1"],
280
- ["admin card with admin fields", "admin field 1", "admin field 2"],
280
+ ["admin card with admin fields", "admin field 1", "admin field 2"]
281
281
  ].each do |name, f1, f2|
282
282
  create name,
283
283
  content: "main content {{+#{f1}}} {{+#{f2}}}",
@@ -297,25 +297,24 @@ class SharedData
297
297
  end
298
298
  create ["field 1", :right, :read], type: "Pointer", content: "[[Anyone]]"
299
299
  end
300
-
301
300
  end
302
301
  end
303
302
 
304
- TEXT = <<-TXT.strip_heredoc.freeze
305
- Far out in the uncharted backwaters of the unfashionable end of
306
- the western spiral arm of the Galaxy lies a small unregarded
307
- yellow sun.
308
-
309
- Orbiting this at a distance of roughly ninety-two million miles
310
- is an utterly insignificant little blue green planet whose ape-
311
- descended life forms are so amazingly primitive that they still
312
- think digital watches are a pretty neat idea.
313
-
314
- This planet has - or rather had - a problem, which was this: most
315
- of the people living on it were unhappy for pretty much of the time.
316
- Many solutions were suggested for this problem, but most of these
317
- were largely concerned with the movements of small green pieces
318
- of paper, which is odd because on the whole it wasn't the small
319
- green pieces of paper that were unhappy.
303
+ TEXT = <<~TXT.strip_heredoc.freeze
304
+ Far out in the uncharted backwaters of the unfashionable end of
305
+ the western spiral arm of the Galaxy lies a small unregarded
306
+ yellow sun.
307
+ #{' '}
308
+ Orbiting this at a distance of roughly ninety-two million miles
309
+ is an utterly insignificant little blue green planet whose ape-
310
+ descended life forms are so amazingly primitive that they still
311
+ think digital watches are a pretty neat idea.
312
+ #{' '}
313
+ This planet has - or rather had - a problem, which was this: most
314
+ of the people living on it were unhappy for pretty much of the time.
315
+ Many solutions were suggested for this problem, but most of these
316
+ were largely concerned with the movements of small green pieces
317
+ of paper, which is odd because on the whole it wasn't the small
318
+ green pieces of paper that were unhappy.
320
319
  TXT
321
320
  end
data/lib/card.rb CHANGED
@@ -167,6 +167,7 @@ class Card < ApplicationRecord
167
167
  ]
168
168
 
169
169
  attr_accessor(*action_specific_attributes)
170
+
170
171
  self.action_specific_attributes +=
171
172
  %i[skip_hash full_skip_hash trigger_hash full_trigger_hash]
172
173
 
@@ -25,8 +25,8 @@ class Card
25
25
  def decode token
26
26
  decoded = JWT.decode(token, SECRET_KEY)[0]
27
27
  HashWithIndifferentAccess.new decoded
28
- rescue JWT::DecodeError => error
29
- error.message
28
+ rescue JWT::DecodeError => e
29
+ e.message
30
30
  end
31
31
 
32
32
  def expiration
data/lib/card/cache.rb CHANGED
@@ -53,6 +53,7 @@ class Card
53
53
  # on the persistent caches.
54
54
  def renew
55
55
  return if no_renewal
56
+
56
57
  renew_persistent
57
58
  cache_by_class.each_value do |cache|
58
59
  cache.soft.reset
@@ -175,7 +176,7 @@ class Card
175
176
  # test for the existence of the key in either cache
176
177
  # @return [true/false]
177
178
  def exist? key
178
- @soft.exist?(key) || (@hard&.exist?(key))
179
+ @soft.exist?(key) || @hard&.exist?(key)
179
180
  end
180
181
  end
181
182
  end
@@ -4,6 +4,7 @@ class Card
4
4
  module All
5
5
  def expire cache_type=nil
6
6
  return unless (cache_class = cache_class_from_type cache_type)
7
+
7
8
  expire_views
8
9
  expire_names cache_class
9
10
  expire_id cache_class
@@ -47,8 +48,10 @@ class Card
47
48
 
48
49
  def expire_name name_version, cache
49
50
  return unless name_version.present?
51
+
50
52
  key_version = name_version.to_name.key
51
53
  return unless key_version.present?
54
+
52
55
  cache.delete key_version
53
56
  end
54
57
 
@@ -57,6 +60,7 @@ class Card
57
60
  # puts "EXPIRE VIEW CACHE (#{name}): #{view_cache_keys}"
58
61
  view_keys = hard_read_view_cache_keys key
59
62
  next unless view_keys.present?
63
+
60
64
  expire_view_cache_keys view_keys
61
65
  end
62
66
  @view_cache_keys = []
@@ -64,6 +68,7 @@ class Card
64
68
 
65
69
  def expire_id cache
66
70
  return unless id.present?
71
+
67
72
  cache.delete "~#{id}"
68
73
  end
69
74
 
@@ -4,6 +4,7 @@ class Card
4
4
  module CardClass
5
5
  def retrieve_from_cache cache_key, local_only=false
6
6
  return unless cache
7
+
7
8
  local_only ? cache.soft.read(cache_key) : cache.read(cache_key)
8
9
  end
9
10
 
@@ -28,12 +29,14 @@ class Card
28
29
 
29
30
  def write_to_soft_cache card
30
31
  return unless cache
32
+
31
33
  cache.soft.write card.key, card
32
34
  end
33
35
 
34
36
  def expire name
35
37
  key = name.to_name.key
36
38
  return unless (card = Card.cache.read key)
39
+
37
40
  card.expire
38
41
  end
39
42
  end
data/lib/card/codename.rb CHANGED
@@ -143,7 +143,7 @@ class Card
143
143
 
144
144
  def id_constant codename, id=nil
145
145
  id ||= id! codename
146
- Card.const_get_or_set(codename.to_s.camelize + "ID") { id }
146
+ Card.const_get_or_set("#{codename.to_s.camelize}ID") { id }
147
147
  end
148
148
  end
149
149
 
data/lib/card/content.rb CHANGED
@@ -99,16 +99,12 @@ class Card
99
99
  "<#{__getobj__.class}:#{card}:#{self}>"
100
100
  end
101
101
 
102
- def without_nests
103
- without_chunks Chunk::Nest do |content|
104
- yield content
105
- end
102
+ def without_nests &block
103
+ without_chunks Chunk::Nest, &block
106
104
  end
107
105
 
108
- def without_references
109
- without_chunks Chunk::Nest, Chunk::Link do |content|
110
- yield content
111
- end
106
+ def without_references &block
107
+ without_chunks Chunk::Nest, Chunk::Link, &block
112
108
  end
113
109
 
114
110
  def without_chunks *chunk_classes
@@ -69,7 +69,7 @@ class Card
69
69
  chunk_class = const_get chunkname
70
70
  chunk_class.config[:prefix_re]
71
71
  end
72
- /(?:#{ prefix_res * '|' })/m
72
+ /(?:#{prefix_res * '|'})/m
73
73
  end
74
74
 
75
75
  def validate_chunk_list_key chunk_list_key
@@ -46,7 +46,7 @@ class Card
46
46
  # $LAST_MATCH_INFO is nil if string is a SafeBuffer
47
47
  string.to_str.gsub(%r{<(/*)(\w+)([^>]*)>}) do |_raw|
48
48
  clean_tag $LAST_MATCH_INFO, ok_tags
49
- end.gsub(/<\!--.*?-->/, "")
49
+ end.gsub(/<!--.*?-->/, "")
50
50
  end
51
51
 
52
52
  def clean_spaces string
@@ -56,6 +56,7 @@ class Card
56
56
  def clean_tag match, ok_tags
57
57
  tag = match[2].downcase
58
58
  return " " unless (ok_attrs = ok_tags[tag])
59
+
59
60
  "<#{match[1]}#{html_attribs tag, match[3], ok_attrs}>"
60
61
  end
61
62
 
@@ -70,7 +71,7 @@ class Card
70
71
  return ['"', nil] unless all_attributes =~ /\b#{attrib}\s*=\s*(?=(.))/i
71
72
 
72
73
  q = '"'
73
- rest_value = $'
74
+ rest_value = Regexp.last_match.post_match
74
75
  if (idx = %w[' "].index Regexp.last_match(1))
75
76
  q = Regexp.last_match(1)
76
77
  end
@@ -79,7 +80,7 @@ class Card
79
80
  [q, rest_value]
80
81
  end
81
82
 
82
- # NOTE allows classes beginning with "w-" (deprecated)
83
+ # NOTE: allows classes beginning with "w-" (deprecated)
83
84
  def process_attribute_match rest_value, reg_exp, attrib
84
85
  return rest_value unless (match = rest_value.match reg_exp)
85
86
 
@@ -22,6 +22,7 @@ class Card
22
22
  end
23
23
 
24
24
  attr_reader :result
25
+
25
26
  delegate :summary, :complete, :summary_omits_content?, to: :result
26
27
 
27
28
  # diff options
@@ -41,11 +42,11 @@ class Card
41
42
  end
42
43
 
43
44
  def red?
44
- @result.dels_cnt > 0
45
+ @result.dels_cnt.positive?
45
46
  end
46
47
 
47
48
  def green?
48
- @result.adds_cnt > 0
49
+ @result.adds_cnt.positive?
49
50
  end
50
51
 
51
52
  private
@@ -42,7 +42,7 @@ class Card
42
42
  case action
43
43
  when "-" then del_old_excludees
44
44
  when "+" then add_new_excludees
45
- when "!" then
45
+ when "!"
46
46
  del_old_excludees
47
47
  add_new_excludees
48
48
  else
@@ -4,6 +4,7 @@ class Card
4
4
  # Result object for Diff processing
5
5
  class Result
6
6
  attr_accessor :complete, :summary, :dels_cnt, :adds_cnt
7
+
7
8
  def initialize summary_opts=nil
8
9
  @dels_cnt = 0
9
10
  @adds_cnt = 0
@@ -62,7 +62,7 @@ class Card
62
62
  # prefix of matched chunk
63
63
  @chunk_start = prefix_match.begin(0) + @position
64
64
  # content index of beginning of chunk
65
- if prefix_match.begin(0) > 0
65
+ if prefix_match.begin(0).positive?
66
66
  # if matched chunk is not beginning of test string
67
67
  @interval_string += @content[@position..@chunk_start - 1]
68
68
  # hold onto the non-chunk part of the string
@@ -87,7 +87,7 @@ class Card
87
87
  @chunks << @chunk_class.new(@match, @content_object)
88
88
  # add the chunk to the chunk list
89
89
  @last_position = @position
90
- # note that the end of the chunk was the last place where a
90
+ # NOTE: that the end of the chunk was the last place where a
91
91
  # chunk was found (so far)
92
92
  true
93
93
  end
@@ -9,7 +9,7 @@ class Card
9
9
 
10
10
  truncated, wordstring = truncate input, words
11
11
  # nuke partial tags at end of snippet
12
- wordstring.gsub!(/(<[^\>]+)$/, "")
12
+ wordstring.gsub!(/(<[^>]+)$/, "")
13
13
  wordstring = close_tags wordstring
14
14
  wordstring += ELLIPSES_HTML if truncated
15
15
  # wordstring += '...' if wordlist.length > l
@@ -34,9 +34,9 @@ class Card
34
34
  end
35
35
 
36
36
  def polish wordstring
37
- wordstring.gsub! %r{<[/]?br[\s/]*>}, " "
37
+ wordstring.gsub! %r{</?br[\s/]*>}, " "
38
38
  # Also a hack -- get rid of <br>'s -- they make line view ugly.
39
- wordstring.gsub! %r{<[/]?p[^>]*>}, " "
39
+ wordstring.gsub! %r{</?p[^>]*>}, " "
40
40
  ## Also a hack -- get rid of <br>'s -- they make line view ugly.
41
41
  wordstring
42
42
  end
@@ -45,17 +45,17 @@ class Card
45
45
  tags = []
46
46
 
47
47
  # match tags with or without self closing (ie. <foo />)
48
- wordstring.scan(%r{\<([^\>\s/]+)[^\>]*?\>}).each do |t|
48
+ wordstring.scan(%r{<([^>\s/]+)[^>]*?>}).each do |t|
49
49
  tags.unshift(t[0])
50
50
  end
51
51
  # match tags with self closing and mark them as closed
52
- wordstring.scan(%r{\<([^\>\s/]+)[^\>]*?/\>}).each do |t|
52
+ wordstring.scan(%r{<([^>\s/]+)[^>]*?/>}).each do |t|
53
53
  next unless (x = tags.index(t[0]))
54
54
 
55
55
  tags.slice!(x)
56
56
  end
57
57
  # match close tags
58
- wordstring.scan(%r{\</([^\>\s/]+)[^\>]*?\>}).each do |t|
58
+ wordstring.scan(%r{</([^>\s/]+)[^>]*?>}).each do |t|
59
59
  next unless (x = tags.rindex(t[0]))
60
60
 
61
61
  tags.slice!(x)