card 1.109.1 → 1.110.0

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 (67) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/lib/card/auth/current.rb +1 -1
  4. data/lib/card/auth/proxy.rb +2 -2
  5. data/lib/card/cache/class_methods.rb +1 -1
  6. data/lib/card/cache/shared.rb +3 -2
  7. data/lib/card/content/chunk.rb +2 -2
  8. data/lib/card/content/parser.rb +4 -4
  9. data/lib/card/content.rb +7 -9
  10. data/lib/card/director/all.rb +4 -4
  11. data/lib/card/director/card_class.rb +3 -3
  12. data/lib/card/director/event_delay.rb +2 -2
  13. data/lib/card/director/phases.rb +2 -2
  14. data/lib/card/director/store.rb +2 -2
  15. data/lib/card/env/location_history.rb +7 -7
  16. data/lib/card/error.rb +2 -2
  17. data/lib/card/fetch/card_class.rb +2 -2
  18. data/lib/card/format/card_action_view.rb +1 -1
  19. data/lib/card/format/content.rb +4 -4
  20. data/lib/card/format/method_delegation.rb +4 -4
  21. data/lib/card/format/nesting/mode.rb +2 -2
  22. data/lib/card/format/render.rb +10 -9
  23. data/lib/card/format/wrapper.rb +2 -2
  24. data/lib/card/model/save_helper/save_helper_helper.rb +2 -2
  25. data/lib/card/model/save_helper.rb +2 -2
  26. data/lib/card/name/all/parts.rb +10 -10
  27. data/lib/card/name/all.rb +0 -2
  28. data/lib/card/name.rb +3 -3
  29. data/lib/card/query/card_class.rb +2 -2
  30. data/lib/card/query/card_query/interpretation.rb +1 -1
  31. data/lib/card/query/card_query/normalization.rb +1 -1
  32. data/lib/card/query/card_query.rb +2 -1
  33. data/lib/card/query/sql_statement/where.rb +1 -1
  34. data/lib/card/reference/all.rb +2 -2
  35. data/lib/card/set/advanced_api.rb +4 -3
  36. data/lib/card/set/event/all.rb +1 -1
  37. data/lib/card/set/event.rb +6 -8
  38. data/lib/card/set/format/abstract_format/haml_views.rb +2 -2
  39. data/lib/card/set/format/abstract_format/view_definition.rb +6 -6
  40. data/lib/card/set/format/abstract_format/wrapper.rb +5 -5
  41. data/lib/card/set/format/abstract_format.rb +7 -5
  42. data/lib/card/set/format/haml_paths.rb +2 -2
  43. data/lib/card/set/format.rb +2 -2
  44. data/lib/card/set/inheritance.rb +1 -1
  45. data/lib/card/set/pattern/base.rb +1 -0
  46. data/lib/card/set/required_field.rb +1 -1
  47. data/lib/card/subcards.rb +4 -4
  48. data/lib/card/view/cache/cache_action.rb +13 -7
  49. data/lib/card/view/cache.rb +13 -12
  50. data/lib/cardio/command/rspec_command/parser.rb +1 -1
  51. data/lib/cardio/generators/deck_helper.rb +1 -1
  52. data/lib/cardio/job.rb +0 -1
  53. data/lib/cardio/mod/dirs.rb +2 -2
  54. data/lib/cardio/mod/eat.rb +4 -4
  55. data/lib/cardio/mod/load_strategy/set_binding_magic.rb +2 -2
  56. data/lib/cardio/mod/loader/set_loader.rb +1 -1
  57. data/lib/cardio/mod/loader.rb +2 -2
  58. data/lib/cardio/mod/sow.rb +1 -1
  59. data/lib/cardio/seed.rb +1 -1
  60. data/lib/generators/deck/deck_generator.rb +1 -1
  61. data/lib/generators/migration/migration_generator.rb +1 -0
  62. data/mod/core/lib/tasks/card/trash.rake +8 -0
  63. data/mod/core/lib/tasks/card.rake +17 -17
  64. data/mod/core/set/all/assign_attributes.rb +3 -3
  65. data/mod/core/set/all/initialize.rb +2 -2
  66. data/mod/core/set/self/mod.rb +2 -2
  67. metadata +5 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bbc2d91a4b4e085e2dd391ba227f58cefe096a055354fb5850d5a983db9b389f
4
- data.tar.gz: 0c8ced971a5730ae8f4898b967fb3063beb0ba4415957ead6c963619eabd7674
3
+ metadata.gz: abe5aee55e82a21646046cd81ce981f95e68ec7a5c013d065e4a49202a268e22
4
+ data.tar.gz: 35909d80d33bd11bc6084c52adab226d655f1052df391b6e4da86c3a2275a525
5
5
  SHA512:
6
- metadata.gz: 8e92113ce1c6777355ba6f4e0d81936c0b2a80ff8718b50acca6782b9f029268e087183fc2a77c179805a4bb7e12a3b54f025acab6acde19df470f2215e51d1d
7
- data.tar.gz: abba860d2387151ba48e3690fddb88c552e31c7770aa7a37fc75006db47f667a422a8632950e2e162742428f461144330a4d0e2487637c99889312106a07d18c
6
+ metadata.gz: 7e270754fe2e275c495bb908e9d2e6a4d0f955babc02b9368c28d6ab4a07198f63453d431b7b0cd6a5900c9e1a885447c78f74c3428848efd80c73097eb8fc76
7
+ data.tar.gz: de120f96396a0b25f6f49f4154c936b497a94e806b02b6634af4db31fb478348ddd4a8dee610085fc38d0dba2baef428df6b6998b7f71a25d4f7b16f05b92824
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.19.1
1
+ 0.20.0
@@ -80,7 +80,7 @@ class Card
80
80
  end
81
81
 
82
82
  def session_user_key
83
- "user_#{Cardio.database.underscore}".to_sym
83
+ :"user_#{Cardio.database.underscore}"
84
84
  end
85
85
 
86
86
  private
@@ -24,8 +24,8 @@ class Card
24
24
  end
25
25
 
26
26
  # operate with the permissions of DeckoBot (administrator)
27
- def as_bot &block
28
- as Card::DeckoBotID, &block
27
+ def as_bot(&)
28
+ as(Card::DeckoBotID, &)
29
29
  end
30
30
 
31
31
  # id of proxy user
@@ -12,7 +12,7 @@ class Card
12
12
  def [] klass
13
13
  raise "nil klass" if klass.nil?
14
14
 
15
- cache_by_class[klass] ||= new class: klass, store: (shared_cache || nil)
15
+ cache_by_class[klass] ||= new class: klass, store: shared_cache || nil
16
16
  end
17
17
 
18
18
  # clear the temporary caches and ensure we're using the latest stamp
@@ -16,6 +16,7 @@ class Card
16
16
  #
17
17
  class Shared
18
18
  extend SharedClass
19
+
19
20
  # @param opts [Hash]
20
21
  # @option opts [Rails::Cache] :store
21
22
  # @option opts [ruby Class] :class, typically ActiveRecord descendant
@@ -116,8 +117,8 @@ class Card
116
117
  @store.write full_key(key), value
117
118
  end
118
119
 
119
- def fetch key, &block
120
- @store.fetch full_key(key), &block
120
+ def fetch(key, &)
121
+ @store.fetch(full_key(key), &)
121
122
  end
122
123
 
123
124
  def delete key
@@ -72,9 +72,9 @@ class Card
72
72
  end
73
73
 
74
74
  def validate_chunk_list_key chunk_list_key
75
- unless raw_list.key? chunk_list_key
75
+ return if raw_list.key? chunk_list_key
76
+
76
77
  raise ArgumentError, "invalid chunk list key: #{chunk_list_key}"
77
- end
78
78
  end
79
79
  end
80
80
 
@@ -60,7 +60,8 @@ class Card
60
60
 
61
61
  def match_prefix prefix_regexp
62
62
  prefix_match = @content[@position..].match(prefix_regexp)
63
- if prefix_match
63
+ return unless prefix_match
64
+
64
65
  @prefix = prefix_match[0]
65
66
  # prefix of matched chunk
66
67
  @chunk_start = prefix_match.begin(0) + @position
@@ -73,7 +74,6 @@ class Card
73
74
  @position = @chunk_start
74
75
  # move scanning position up to beginning of chunk
75
76
  true
76
- end
77
77
  end
78
78
 
79
79
  def record_chunk
@@ -98,10 +98,10 @@ class Card
98
98
  end
99
99
 
100
100
  def handle_remainder
101
- if @chunks.any? && @last_position < @content.size
101
+ return unless @chunks.any? && @last_position < @content.size
102
+
102
103
  # handle any leftover nonchunk string at the end of content
103
104
  @chunks << @content[@last_position..]
104
- end
105
105
  end
106
106
  end
107
107
  end
data/lib/card/content.rb CHANGED
@@ -7,9 +7,7 @@ class Card
7
7
  # Each chunk has an object whose class inherits from {Card::Content::Chunk::Abstract}
8
8
  #
9
9
  class Content < SimpleDelegator
10
- extend Clean
11
-
12
- Chunk # trigger autoload
10
+ extend Clean # trigger autoload
13
11
 
14
12
  attr_reader :revision, :format, :chunks, :opts
15
13
 
@@ -47,8 +45,8 @@ class Card
47
45
  end
48
46
 
49
47
  # sends &block to #process_chunk on each Chunk object
50
- def process_chunks &block
51
- return custom_process_chunks(&block) if block_given?
48
+ def process_chunks(&)
49
+ return custom_process_chunks(&) if block_given?
52
50
 
53
51
  each_chunk(&:process_chunk)
54
52
  end
@@ -98,12 +96,12 @@ class Card
98
96
  "<#{__getobj__.class}:#{card}:#{self}>"
99
97
  end
100
98
 
101
- def without_nests &block
102
- without_chunks Chunk::Nest, &block
99
+ def without_nests(&)
100
+ without_chunks(Chunk::Nest, &)
103
101
  end
104
102
 
105
- def without_references &block
106
- without_chunks Chunk::Nest, Chunk::Link, Chunk::EscapedLiteral, &block
103
+ def without_references(&)
104
+ without_chunks(Chunk::Nest, Chunk::Link, Chunk::EscapedLiteral, &)
107
105
  end
108
106
 
109
107
  def without_chunks *chunk_classes
@@ -27,11 +27,11 @@ class Card
27
27
  end
28
28
  end
29
29
 
30
- def act options={}, &block
30
+ def act(options={}, &)
31
31
  if act_card
32
- add_to_act options, &block
32
+ add_to_act(options, &)
33
33
  else
34
- start_new_act(&block)
34
+ start_new_act(&)
35
35
  end
36
36
  end
37
37
 
@@ -45,7 +45,7 @@ class Card
45
45
 
46
46
  def save! **args
47
47
  as_subcard = args.delete :as_subcard
48
- act(as_subcard: as_subcard) { super **args }
48
+ act(as_subcard: as_subcard) { super(**args) }
49
49
  end
50
50
 
51
51
  def save *_args
@@ -107,11 +107,11 @@ class Card
107
107
  end
108
108
  end
109
109
 
110
- def ensuring_purity card, other, opts, &block
110
+ def ensuring_purity(card, other, opts, &)
111
111
  if opts[:codename] && other
112
- ensure_purity_advanced card, other, opts, &block
112
+ ensure_purity_advanced(card, other, opts, &)
113
113
  else
114
- ensure_purity_simple card, &block
114
+ ensure_purity_simple(card, &)
115
115
  end
116
116
  end
117
117
 
@@ -20,10 +20,10 @@ class Card
20
20
  Cardio.config.delaying == true
21
21
  end
22
22
 
23
- def with_delay_act act_id, card, &block
23
+ def with_delay_act(act_id, card, &)
24
24
  return yield unless act_id && (self.act = Act.find act_id)
25
25
 
26
- run_job_with_act act, card, &block
26
+ run_job_with_act(act, card, &)
27
27
  end
28
28
 
29
29
  def run_job_with_act act, card, &block
@@ -31,10 +31,10 @@ class Card
31
31
 
32
32
  # Unlike other phases, the storage phase takes a block,
33
33
  # because it is called by an "around" callback
34
- def storage_phase &block
34
+ def storage_phase(&)
35
35
  catch_up_to_stage :prepare_to_store # unless @abort
36
36
  # puts "before store #{@card.name}: abort:#{@abort}"
37
- run_stage :store, &block # unless @abort
37
+ run_stage(:store, &) # unless @abort
38
38
  run_stage :finalize # unless @abort
39
39
  raise ActiveRecord::RecordInvalid, @card if @card.errors.any?
40
40
  ensure
@@ -21,14 +21,14 @@ class Card
21
21
  # the subcards as we do in the other phases.
22
22
  # Instead we have to call `save` on the subcards and use the ActiveRecord
23
23
  # :around_save callback.
24
- def store &save_block
24
+ def store(&)
25
25
  raise Card::Error, "need block to store main card" if main? && !block_given?
26
26
 
27
27
  # the block is the ActiveRecord block from the around save callback that
28
28
  # saves the card
29
29
  if block_given?
30
30
  run_stage_callbacks :store
31
- store_with_subcards(&save_block)
31
+ store_with_subcards(&)
32
32
  else
33
33
  trigger_storage_phase_callback
34
34
  end
@@ -26,13 +26,13 @@ class Card
26
26
  end.compact
27
27
  end
28
28
 
29
- def save_interrupted_action uri
30
- session[:interrupted_action] = uri
31
- end
29
+ # def save_interrupted_action uri
30
+ # session[:interrupted_action] = uri
31
+ # end
32
32
 
33
- def interrupted_action
34
- session.delete :interrupted_action
35
- end
33
+ # def interrupted_action
34
+ # session.delete :interrupted_action
35
+ # end
36
36
 
37
37
  private
38
38
 
@@ -41,7 +41,7 @@ class Card
41
41
  end
42
42
 
43
43
  def location_cardname location
44
- URI.parse(location).path.sub(/^\//, "").sub(/\/.*$/, "")&.cardname
44
+ URI.parse(location).path.sub(%r{^/}, "").sub(%r{/.*$}, "")&.cardname
45
45
  end
46
46
 
47
47
  def save_location? card
data/lib/card/error.rb CHANGED
@@ -27,7 +27,7 @@ class Card
27
27
  self.card = message
28
28
  message = message_from_card
29
29
  end
30
- super message
30
+ super
31
31
  end
32
32
 
33
33
  def message_from_card
@@ -119,7 +119,7 @@ class Card
119
119
 
120
120
  def initialize status, msg=""
121
121
  @status = status
122
- super msg
122
+ super(msg)
123
123
  end
124
124
  end
125
125
 
@@ -28,8 +28,8 @@ class Card
28
28
  # new: { opts for Card#new } Return a new card when not found
29
29
  #
30
30
  # @return [Card]
31
- def fetch *args
32
- f = Fetch.new(*args)
31
+ def fetch(*)
32
+ f = Fetch.new(*)
33
33
  f.retrieve_or_new
34
34
  rescue ActiveModel::RangeError => _e
35
35
  Card.new name: "card id out of range: #{f.mark}"
@@ -4,7 +4,7 @@ class Card
4
4
  class CardActionView < ActionView::Base
5
5
  class << self
6
6
  def new controller
7
- super lookup_context, { _routes: nil }, controller
7
+ super(lookup_context, { _routes: nil }, controller)
8
8
  end
9
9
 
10
10
  def lookup_context
@@ -1,18 +1,18 @@
1
1
  class Card
2
2
  class Format
3
3
  module Content
4
- def process_content override_content=nil, content_opts=nil, &block
4
+ def process_content(override_content=nil, content_opts=nil, &)
5
5
  content_obj = content_object override_content, content_opts
6
- content_obj.process_chunks(&block)
6
+ content_obj.process_chunks(&)
7
7
  content_obj.to_s
8
8
  end
9
9
 
10
10
  # 1. Break out references (nests / links) into separate chunks
11
11
  # 2. yields the other (non-ref) content
12
12
  # 3. processes references
13
- def safe_process_content override_content=nil, content_opts=nil, &block
13
+ def safe_process_content(override_content=nil, content_opts=nil, &)
14
14
  content_obj = content_object override_content, chunk_list: :references
15
- process_content content_obj.without_references(&block), content_opts
15
+ process_content content_obj.without_references(&), content_opts
16
16
  end
17
17
 
18
18
  # nested by another card's content
@@ -38,11 +38,11 @@ class Card
38
38
  # TODO: make it so we fall back to super if action_view can't handle method.
39
39
  # It's not as easy as `elsif api_render? method`, because respond_to gives
40
40
  # false for many methods action view can actually handle, like `h`
41
- def method_missing method, *opts, &proc
41
+ def method_missing(method, *opts, &)
42
42
  if (match = api_render? method)
43
43
  api_render match, opts
44
44
  else
45
- delegate_to_action_view method, opts, &proc
45
+ delegate_to_action_view(method, opts, &)
46
46
  end
47
47
  end
48
48
 
@@ -54,8 +54,8 @@ class Card
54
54
  end
55
55
  end
56
56
 
57
- def interpret_render_opts opts, &block
58
- (opts[0] ? opts.shift.clone : {}).tap(&block)
57
+ def interpret_render_opts(opts, &)
58
+ (opts[0] ? opts.shift.clone : {}).tap(&)
59
59
  end
60
60
 
61
61
  def optional_render_opt opts, args
@@ -21,11 +21,11 @@ class Card
21
21
  # run block with new_mode as nest_mode, then return to prior mode
22
22
  # @param new_mode [Symbol] :normal, :compact, :edit, or :template
23
23
  # @return block result
24
- def with_nest_mode new_mode, &block
24
+ def with_nest_mode(new_mode, &)
25
25
  if new_mode == @nest_mode
26
26
  yield
27
27
  else
28
- with_altered_nest_mode new_mode, &block
28
+ with_altered_nest_mode(new_mode, &)
29
29
  end
30
30
  end
31
31
 
@@ -47,7 +47,7 @@ class Card
47
47
  end
48
48
 
49
49
  # see {Abstract::Format}
50
- # (:default), :yes, :deep, :always, :never
50
+ # (:default), :yes, :deep, :force, :always, :never
51
51
  def view_cache_setting view
52
52
  voo&.cache || view_setting(:cache, view) || :default
53
53
  end
@@ -60,6 +60,7 @@ class Card
60
60
  return cached_content if Cardio.config.view_cache == :debug
61
61
 
62
62
  # stub_debugging do
63
+ # Rails.logger.info cached_content
63
64
  expand_stubs cached_content
64
65
  # end
65
66
  end
@@ -115,14 +116,14 @@ class Card
115
116
  Env.params[:debug] == "view"
116
117
  end
117
118
 
118
- # def stub_debugging
119
- # result = yield
120
- # if Rails.env.development? && result.is_a?(String) && result =~ /StUb/
121
- # Rails.logger.debug "STUB IN RENDERED VIEW: #{card.name}: " \
122
- # "#{voo.ok_view}\n#{result}"
123
- # end
124
- # result
125
- # end
119
+ def stub_debugging
120
+ result = yield
121
+ if Rails.env.development? && result.is_a?(String) && result =~ /StUb/
122
+ Rails.logger.debug "STUB IN RENDERED VIEW: #{card.name}: " \
123
+ "#{voo.ok_view}\n#{result}"
124
+ end
125
+ result
126
+ end
126
127
 
127
128
  def prepare_stub_nest stub_hash
128
129
  stub_card = Card.fetch_from_cast stub_hash[:cast]
@@ -41,9 +41,9 @@ class Card
41
41
  def raise_wrap_error wrapper
42
42
  if wrapper.is_a? String
43
43
  raise Card::Error::UserError, "unknown layout card: #{wrapper}"
44
- else
45
- raise ArgumentError, "unknown wrapper: #{wrapper}"
46
44
  end
45
+
46
+ raise ArgumentError, "unknown wrapper: #{wrapper}"
47
47
  end
48
48
 
49
49
  def send_wrapper_method method_name, opts
@@ -17,11 +17,11 @@ class Card
17
17
  Card.exist? name
18
18
  end
19
19
 
20
- def method_missing method, *args
20
+ def method_missing(method, *)
21
21
  method_name, cardtype_card = extract_cardtype_from_method_name method
22
22
  return super unless method_name
23
23
 
24
- sargs = standardize_args(*args).merge(type_id: cardtype_card.id)
24
+ sargs = standardize_args(*).merge(type_id: cardtype_card.id)
25
25
  if method_name == "ensure"
26
26
  Card.ensure sargs
27
27
  else
@@ -12,8 +12,8 @@ class Card
12
12
  include SaveHelperHelper
13
13
  include SaveArguments
14
14
 
15
- def with_user user_name, &block
16
- Card::Auth.with(current_id: user_name.card_id, &block)
15
+ def with_user(user_name, &)
16
+ Card::Auth.with(current_id: user_name.card_id, &)
17
17
  end
18
18
 
19
19
  def create_card name_or_args, content_or_args=nil
@@ -3,14 +3,14 @@ class Card
3
3
  module All
4
4
  # Card methods for handling name parts, eg A and B are both parts of A+B
5
5
  module Parts
6
- def left *args
6
+ def left(*)
7
7
  case
8
8
  when simple? then nil
9
9
  when superleft then superleft
10
10
  when name_is_changing? && name.to_name.trunk_name == name_before_act.to_name
11
11
  nil # prevent recursion when, eg, renaming A+B to A+B+C
12
12
  else
13
- Card.fetch name.left, *args
13
+ Card.fetch(name.left, *)
14
14
  end
15
15
  end
16
16
 
@@ -18,16 +18,16 @@ class Card
18
18
  left(args) || Card.new(args.merge(name: name.left))
19
19
  end
20
20
 
21
- def right *args
22
- Card.fetch(name.right, *args) unless simple?
21
+ def right(*)
22
+ Card.fetch(name.right, *) unless simple?
23
23
  end
24
24
 
25
- def trunk *args
26
- simple? ? self : left(*args)
25
+ def trunk(*)
26
+ simple? ? self : left(*)
27
27
  end
28
28
 
29
- def tag *args
30
- simple? ? self : Card.fetch(name.right, *args)
29
+ def tag(*)
30
+ simple? ? self : Card.fetch(name.right, *)
31
31
  end
32
32
 
33
33
  def right_id= cardish
@@ -44,11 +44,11 @@ class Card
44
44
  when_id_exists(cardish) { |id| write_attribute attribute, id }
45
45
  end
46
46
 
47
- def when_id_exists cardish, &block
47
+ def when_id_exists(cardish, &)
48
48
  if (card_id = Card.id cardish)
49
49
  yield card_id
50
50
  elsif cardish.is_a? Card
51
- with_id_after_store cardish, &block
51
+ with_id_after_store(cardish, &)
52
52
  else
53
53
  yield cardish # eg nil
54
54
  end
data/lib/card/name/all.rb CHANGED
@@ -24,7 +24,6 @@ class Card
24
24
  update_subcard_names @name
25
25
  write_attribute :name, (@name.simple? ? @name.s : nil)
26
26
  assign_side_ids
27
- @name
28
27
  end
29
28
 
30
29
  def [] *args
@@ -70,7 +69,6 @@ class Card
70
69
  @key = newkey
71
70
  end
72
71
  clean_patterns
73
- @key
74
72
  end
75
73
 
76
74
  private
data/lib/card/name.rb CHANGED
@@ -40,7 +40,7 @@ class Card
40
40
  elsif (id = id_from_string str) # handles ~[id] and :[codename]
41
41
  from_id_from_string id, str
42
42
  else
43
- super str
43
+ super(str)
44
44
  end
45
45
  end
46
46
 
@@ -89,8 +89,8 @@ class Card
89
89
  new_from_parts(parts) { |part| new part }
90
90
  end
91
91
 
92
- def new_from_parts parts, &block
93
- name_parts = parts.flatten.map(&block)
92
+ def new_from_parts(parts, &)
93
+ name_parts = parts.flatten.map(&)
94
94
  new name_parts.join(joint), true
95
95
  end
96
96
 
@@ -2,9 +2,9 @@ class Card
2
2
  module Query
3
3
  # query-related methods with which to extend Card class
4
4
  module CardClass
5
- def search spec, comment=nil, &block
5
+ def search(spec, comment=nil, &)
6
6
  results = ::Card::Query.run(spec, comment)
7
- results.each(&block) if block_given? && results.is_a?(Array)
7
+ results.each(&) if block_given? && results.is_a?(Array)
8
8
  results
9
9
  end
10
10
 
@@ -103,7 +103,7 @@ class Card
103
103
  end
104
104
 
105
105
  def relate_multi_value_with_subcondition key, conj, val
106
- send conj, (val.map { |v| { key => v } })
106
+ send(conj, val.map { |v| { key => v } })
107
107
  end
108
108
 
109
109
  def relate_multi_value_without_subcondition method, key, val
@@ -28,7 +28,7 @@ class Card
28
28
  case clause
29
29
  when Hash then clause
30
30
  when Integer then { id: clause }
31
- when String then { id: (Card::Lexicon.id(clause) || -2) }
31
+ when String then { id: Card::Lexicon.id(clause) || -2 }
32
32
  when Symbol then { id: Card::Codename.id(clause) }
33
33
  else raise Error::BadQuery, "Invalid clause: #{clause.inspect}"
34
34
  end
@@ -13,6 +13,7 @@ class Card
13
13
  include Sorting
14
14
  include Conjunctions
15
15
  include Custom
16
+
16
17
  # Query Execution
17
18
 
18
19
  # By default a query returns card objects. This is accomplished by returning
@@ -32,7 +33,7 @@ class Card
32
33
  end
33
34
 
34
35
  def initialize statement, comment=nil
35
- super statement
36
+ super(statement)
36
37
  @comment = comment || default_comment
37
38
  interpret @statement
38
39
  end
@@ -3,7 +3,7 @@ class Card
3
3
  class SqlStatement
4
4
  # handle where clause in SqlStatement
5
5
  module Where
6
- def where explicit=true
6
+ def where explicit: true
7
7
  conditions = [explicit_conditions(@query), implicit_conditions(@query)]
8
8
  conditions = conditions.reject(&:blank?).join " AND "
9
9
  "#{'WHERE ' if explicit}#{conditions}" unless conditions.blank?
@@ -113,10 +113,10 @@ class Card
113
113
  end
114
114
  end
115
115
 
116
- def each_reference_type ref_types, &block
116
+ def each_reference_type(ref_types, &)
117
117
  ref_types.delete PARTIAL_REF_CODE if ref_types.size > 1
118
118
  # partial references are not necessary if there are explicit references
119
- ref_types.each(&block)
119
+ ref_types.each(&)
120
120
  end
121
121
 
122
122
  # invokes the given block for each reference in content with
@@ -9,16 +9,17 @@ class Card
9
9
 
10
10
  def setting_opts opts
11
11
  extend Card::Setting
12
+
12
13
  register_setting opts
13
14
  end
14
15
 
15
- def ensure_set &block
16
+ def ensure_set(&)
16
17
  set_module = yield
17
18
  set_module = card_set_module_const_get(set_module) unless set_module.is_a?(Module)
18
19
  rescue NameError => e
19
20
  define_set_from_error e
20
21
  # try again - there might be another submodule that doesn't exist
21
- ensure_set(&block)
22
+ ensure_set(&)
22
23
  else
23
24
  set_module.extend Card::Set
24
25
  end
@@ -32,7 +33,7 @@ class Card
32
33
 
33
34
  def attachment name, args
34
35
  include_set Abstract::Attachment
35
- add_attributes name, "remote_#{name}_url".to_sym,
36
+ add_attributes name, :"remote_#{name}_url",
36
37
  :action_id_of_cached_upload, :empty_ok,
37
38
  :storage_type, :bucket, :mod
38
39
  mount_uploader name, (args[:uploader] || ::CarrierWave::FileCardUploader)